MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_tree_map_serialization

Function test_tree_map_serialization

src/models/serializer/tree_map/tests.rs:299–318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

297
298#[test]
299fn test_tree_map_serialization() {
300 let (dim_bufman, data_bufmans, _cursor, temp_dir) = setup_test();
301 let mut rng = rand::thread_rng();
302 let map = TreeMap::new(dim_bufman, data_bufmans);
303
304 for i in 0..1000 {
305 map.insert(0.into(), &i, rng.gen_range(0..u16::MAX));
306 }
307
308 // edge case
309 map.insert(0.into(), &u64::MAX, rng.gen_range(0..u16::MAX));
310
311 map.serialize().unwrap();
312
313 let (dim_bufman, data_bufmans) = setup_test_in_dir(temp_dir.as_ref());
314
315 let deserialized = TreeMap::<u64, u16>::deserialize(dim_bufman, data_bufmans).unwrap();
316
317 assert_eq!(map, deserialized);
318}
319
320#[test]
321fn test_tree_map_vec_serialization() {

Callers

nothing calls this directly

Calls 4

setup_test_in_dirFunction · 0.85
setup_testFunction · 0.70
insertMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected