MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / large_dataset

Function large_dataset

nodedb-codec/src/fsst.rs:515–527  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

513
514 #[test]
515 fn large_dataset() {
516 let mut strings: Vec<Vec<u8>> = Vec::new();
517 for i in 0..10_000 {
518 strings.push(format!("key-{}-value-{}", i % 100, i % 50).into_bytes());
519 }
520 let refs: Vec<&[u8]> = strings.iter().map(|s| s.as_slice()).collect();
521 let encoded = encode(&refs);
522 let decoded = decode(&encoded).unwrap();
523 assert_eq!(decoded.len(), strings.len());
524 for (a, b) in strings.iter().zip(decoded.iter()) {
525 assert_eq!(a.as_slice(), b.as_slice());
526 }
527 }
528}

Callers

nothing calls this directly

Calls 6

collectMethod · 0.80
encodeFunction · 0.70
decodeFunction · 0.70
pushMethod · 0.45
iterMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected