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

Function downsample_basic

nodedb/src/engine/timeseries/reader.rs:509–517  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508 #[test]
509 fn downsample_basic() {
510 let samples: Vec<(i64, f64)> = (0..100).map(|i| (i * 100, i as f64)).collect();
511 let downsampled = downsample(&samples, 1000);
512 assert_eq!(downsampled.len(), 10);
513 assert_eq!(downsampled[0].0, 0);
514 assert!((downsampled[0].1 - 4.5).abs() < f64::EPSILON);
515 assert_eq!(downsampled[9].0, 9000);
516 assert!((downsampled[9].1 - 94.5).abs() < f64::EPSILON);
517 }
518
519 #[test]
520 fn downsample_empty() {

Callers

nothing calls this directly

Calls 2

downsampleFunction · 0.85
collectMethod · 0.80

Tested by

no test coverage detected