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

Function high_compression_level

nodedb-codec/src/zstd_codec.rs:270–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268
269 #[test]
270 fn high_compression_level() {
271 let data: Vec<u8> = (0..10_000).map(|i| (i % 256) as u8).collect();
272 let default_encoded = encode(&data).unwrap();
273 let high_encoded = encode_with_level(&data, HIGH_LEVEL).unwrap();
274
275 // High level should produce smaller output (or equal).
276 assert!(high_encoded.len() <= default_encoded.len() + 10);
277
278 // Both should roundtrip correctly.
279 assert_eq!(decode(&default_encoded).unwrap(), data);
280 assert_eq!(decode(&high_encoded).unwrap(), data);
281 }
282
283 #[test]
284 fn header_metadata() {

Callers

nothing calls this directly

Calls 3

encode_with_levelFunction · 0.85
collectMethod · 0.80
encodeFunction · 0.70

Tested by

no test coverage detected