Use the #[test] attribute on functions that verify your database logic, then run them with cargo test.
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_database_insert() {
let db = Database::new();
db.insert("key", "value").unwrap();
assert_eq!(db.get("key"), Some("value"));
}
}
Run the tests:
cargo test