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

Function single_sample_roundtrip

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

Source from the content-addressed store, hash-verified

374
375 #[test]
376 fn single_sample_roundtrip() {
377 let mut enc = GorillaEncoder::new();
378 enc.encode(1000, 42.5);
379 let data = enc.finish();
380
381 let mut dec = GorillaDecoder::new(&data);
382 let (ts, val) = dec.next_sample().unwrap();
383 assert_eq!(ts, 1000);
384 assert!((val - 42.5).abs() < f64::EPSILON);
385 assert!(dec.next_sample().is_none());
386 }
387
388 #[test]
389 fn monotonic_timestamps_compress_well() {

Callers

nothing calls this directly

Calls 3

next_sampleMethod · 0.80
encodeMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected