Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kaituo Li <[email protected]>
  • Loading branch information
kaituo committed Apr 9, 2022
1 parent 666b45f commit 9da20e1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,10 @@ public void testParseBuckets() throws InstantiationException,
new MockBigArrays(new MockPageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService()),
1
);
hllpp.collect(0, BitMixer.mix64(randomIntBetween(1, 100)));
hllpp.collect(0, BitMixer.mix64(randomIntBetween(1, 100)));
long hash1 = BitMixer.mix64(randomIntBetween(1, 100));
long hash2 = BitMixer.mix64(randomIntBetween(1, 100));
hllpp.collect(0, hash1);
hllpp.collect(0, hash2);

Constructor ctor = null;
ctor = InternalCardinality.class.getDeclaredConstructor(String.class, AbstractHyperLogLogPlusPlus.class, Map.class);
Expand All @@ -626,7 +628,8 @@ public void testParseBuckets() throws InstantiationException,
assertTrue(parsedResult.isPresent());
double[] parsedCardinality = parsedResult.get();
assertEquals(1, parsedCardinality.length);
assertEquals(2, parsedCardinality[0], 0.001);
double buckets = hash1 == hash2 ? 1 : 2;
assertEquals(buckets, parsedCardinality[0], 0.001);

// release MockBigArrays; otherwise, test will fail
Releasables.close(hllpp);
Expand Down

0 comments on commit 9da20e1

Please sign in to comment.