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

Function identical_values_compress_minimally

nodedb-codec/src/gorilla.rs:409–428  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407
408 #[test]
409 fn identical_values_compress_minimally() {
410 let mut enc = GorillaEncoder::new();
411 for i in 0..100 {
412 enc.encode(1000 + i * 1000, 42.0);
413 }
414 let data = enc.finish();
415
416 assert!(
417 data.len() < 100,
418 "identical values should compress well, got {} bytes",
419 data.len()
420 );
421
422 let mut dec = GorillaDecoder::new(&data);
423 let samples = dec.decode_all();
424 assert_eq!(samples.len(), 100);
425 for s in &samples {
426 assert!((s.1 - 42.0).abs() < f64::EPSILON);
427 }
428 }
429
430 #[test]
431 fn f64_batch_roundtrip() {

Callers

nothing calls this directly

Calls 3

encodeMethod · 0.45
finishMethod · 0.45
decode_allMethod · 0.45

Tested by

no test coverage detected