summaryrefslogtreecommitdiff
path: root/test/ipa/libipa/histogram.cpp
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2025-04-01 14:36:10 +0200
committerStefan Klug <stefan.klug@ideasonboard.com>2025-04-03 12:36:07 +0200
commit781e2f4d0c3bfaf0d53a76b0a0f08aa5c742c7a0 (patch)
tree92b420d0a8b77a13b6ed6bac961e35450258d226 /test/ipa/libipa/histogram.cpp
parent1a17a6aac768f2d521ed873fba4cf127db9928f5 (diff)
test: ipa: libipa: histogram: Add tests for quantile() returning a fraction
Add tests for quantile() returning a fractional value. These cases will get fixed in the next commit. Therefore mark the test as should_fail. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/ipa/libipa/histogram.cpp')
-rw-r--r--test/ipa/libipa/histogram.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ipa/libipa/histogram.cpp b/test/ipa/libipa/histogram.cpp
index 312b88b0..5ce84a61 100644
--- a/test/ipa/libipa/histogram.cpp
+++ b/test/ipa/libipa/histogram.cpp
@@ -42,10 +42,19 @@ protected:
ASSERT_EQ(hist.quantile(1.0), 2.0);
ASSERT_EQ(hist.quantile(0.5), 1.0);
+ /* Test quantile in the middle of a bin. */
+ ASSERT_EQ(hist.quantile(0.75), 1.5);
+
+ /* Test quantile smaller than the smallest histogram step. */
+ ASSERT_EQ(hist.quantile(0.001), 0.002);
+
ASSERT_EQ(hist.interQuantileMean(0.0, 1.0), 1.0);
ASSERT_EQ(hist.interQuantileMean(0.0, 0.5), 0.5);
ASSERT_EQ(hist.interQuantileMean(0.5, 1.0), 1.5);
+ /* Test interquantile mean that starts and ends in the middle of a bin. */
+ ASSERT_EQ(hist.interQuantileMean(0.25, 0.75), 1.0);
+
return TestPass;
}
};