Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
leoparente committed Jan 24, 2024
1 parent 913bd53 commit 62b7566
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tests/test_sketches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ TEST_CASE("Quantiles", "[kll]")

const double fractions[3]{0.0, 0.5, 1.0};
// inclusive (default)
auto quantiles = sketch.get_quantiles(fractions, 3);
auto quantiles = std::vector<float>{sketch.get_quantile(fractions[0]),
sketch.get_quantile(fractions[1]), sketch.get_quantile(fractions[2])};
CHECK(3ul == quantiles.size());
CHECK(0.0f == quantiles[0]);
CHECK(static_cast<float>((n - 1) / 2) == quantiles[1]);
CHECK(static_cast<float>(n - 1) == quantiles[2]);
// exclusive
quantiles = sketch.get_quantiles(fractions, 3, false);
quantiles = std::vector<float>{sketch.get_quantile(fractions[0], false),
sketch.get_quantile(fractions[1], false), sketch.get_quantile(fractions[2], false)};
CHECK(3ul == quantiles.size());
CHECK(0.0f == quantiles[0]);
CHECK(static_cast<float>(n) / 2 == quantiles[1]);
Expand Down

0 comments on commit 62b7566

Please sign in to comment.