Skip to content

Commit 643de78

Browse files
committed
Explicitly test get estimate directly from union
1 parent 7b2d1c2 commit 643de78

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

hll/test/HllUnionTest.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ static void basicUnion(uint64_t n1, uint64_t n2,
5353
v += n2;
5454

5555
hll_union u(lgMaxK);
56-
u.update(std::move(h1));
56+
u.update(h1);
5757
u.update(h2);
5858

5959
hll_sketch result = u.get_result(resultType);
6060

61+
// ensure we check a direct union estimate, without first caling get_result()
62+
u.reset();
63+
u.update(std::move(h1));
64+
u.update(h2);
65+
6166
// force non-HIP estimates to avoid issues with in- vs out-of-order
6267
double uEst = result.get_composite_estimate();
6368
double uUb = result.get_upper_bound(2);
@@ -74,6 +79,7 @@ static void basicUnion(uint64_t n1, uint64_t n2,
7479
REQUIRE((uEst - uLb) >= 0.0);
7580

7681
REQUIRE(controlEst == uEst);
82+
REQUIRE(controlEst == u.get_composite_estimate());
7783
}
7884

7985
/**

0 commit comments

Comments
 (0)