db_map/
lib.rs

1mod db_map;
2pub use db_map::DBMap;
3
4#[cfg(test)]
5mod tests {
6    use crate::*;
7
8    fn is_sync<T: Sync>() { }
9
10    fn is_send<T: Send>() { }
11
12    #[test]
13    fn test_sync() {
14        is_sync::<DBMap<String, u64>>();
15    }
16
17    #[test]
18    fn test_send() {
19        is_send::<DBMap<String, u64>>();
20    }
21
22    #[test]
23    fn test_methods() {
24        let db_map: DBMap<String, u64> = DBMap::new("db_map.db").unwrap();
25        db_map.insert("Test".to_string(), 42).unwrap();
26        db_map.insert("Hello".to_string(), 1).unwrap();
27        db_map.insert("World".to_string(), 1).unwrap();
28        assert_eq!(db_map.get("Test".to_string()).unwrap(), 42);
29        assert_eq!(db_map.get_keys(1).unwrap(), ["Hello".to_string(), "World".to_string()]);
30    }
31}