From 0c05928e14e5ee2ae03566d7bb51e1bfd5c0f281 Mon Sep 17 00:00:00 2001 From: Benjamin Naecker Date: Thu, 29 Aug 2024 01:13:04 +0000 Subject: [PATCH] Histogram adds a leftmost bin --- oximeter/types/src/histogram.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oximeter/types/src/histogram.rs b/oximeter/types/src/histogram.rs index c91ab9f966..2507f2f5c6 100644 --- a/oximeter/types/src/histogram.rs +++ b/oximeter/types/src/histogram.rs @@ -1842,13 +1842,14 @@ mod tests { #[test] fn test_log_bins_u8() { let (bins, _) = Histogram::::power_of_two().bins_and_counts(); - assert_eq!(bins, [1, 2, 4, 8, 16, 32, 64, 128],); + assert_eq!(bins, [0, 1, 2, 4, 8, 16, 32, 64, 128],); } #[test] fn test_log_bins_u64() { let (bins, _) = Histogram::::power_of_two().bins_and_counts(); - for (i, bin) in bins.iter().enumerate() { + assert_eq!(bins[0], 0); + for (i, bin) in bins.iter().skip(1).enumerate() { assert_eq!(*bin, 1u64 << i); } }