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

Function test_tree_map_vec_serialization

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

Source from the content-addressed store, hash-verified

319
320#[test]
321fn test_tree_map_vec_serialization() {
322 let (dim_bufman, data_bufmans, _cursor, temp_dir) = setup_test();
323 let mut rng = rand::thread_rng();
324 let map = TreeMapVec::new(dim_bufman, data_bufmans);
325
326 for i in 0..10000 {
327 map.push(0.into(), &(i / 10), rng.gen_range(0..u16::MAX));
328 }
329
330 // edge case
331 map.push(0.into(), &u64::MAX, rng.gen_range(0..u16::MAX));
332
333 map.serialize().unwrap();
334
335 let (dim_bufman, data_bufmans) = setup_test_in_dir(temp_dir.as_ref());
336
337 let deserialized = TreeMapVec::<u64, u16>::deserialize(dim_bufman, data_bufmans).unwrap();
338
339 assert_eq!(map, deserialized);
340}
341
342#[test]
343fn test_tree_map_incremental_serialization() {

Callers

nothing calls this directly

Calls 4

setup_test_in_dirFunction · 0.85
setup_testFunction · 0.70
pushMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected