Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 0e6bdb9

Browse files
committed
storage/localstore: more GC quantiles Closest test cases
1 parent cf8c7e8 commit 0e6bdb9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

storage/localstore/quantile_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,19 @@ func TestClosest(t *testing.T) {
8383
f fraction
8484
expected *quantile
8585
}{
86-
{fraction{1, 2}, &data[0]},
86+
{fraction{1, 2}, &data[0]}, // exact fraction
87+
{fraction{4, 8}, &data[0]}, // almost same as above
88+
{fraction{1, 3}, &data[1]}, // exact fraction
89+
{fraction{3, 9}, &data[1]}, // almost same as above
90+
{fraction{1, 4}, &data[2]}, // exact fraction
91+
{fraction{1, 5}, &data[2]}, // smaller than any quantile
92+
{fraction{2, 3}, &data[3]}, // exact fraction
93+
{fraction{3, 4}, &data[4]}, // exact fraction
94+
{fraction{4, 4}, &data[4]}, // greater than any quantile
95+
{fraction{2, 1}, &data[4]}, // greater than any quantile
96+
{fraction{4, 10}, &data[1]}, // 0.4 closest to 1/3 (0.33)
97+
{fraction{42, 100}, &data[0]}, // 0.42 closest to 1/2 (0.5)
98+
{fraction{7, 10}, &data[3]}, // 0.7 closest to 2/3 (0.66)
8799
}
88100

89101
for _, check := range checks {

0 commit comments

Comments
 (0)