diff --git a/src/test/java/org/apache/datasketches/theta/UnionImplTest.java b/src/test/java/org/apache/datasketches/theta/UnionImplTest.java index 7c8667b02..4354ede26 100644 --- a/src/test/java/org/apache/datasketches/theta/UnionImplTest.java +++ b/src/test/java/org/apache/datasketches/theta/UnionImplTest.java @@ -223,7 +223,7 @@ public void checkCompactFlagCorruption() { println(""+csk1.getEstimate()); } - @Test + @Test //checks for bug introduced in 1.0.0-incubating. public void checkDirectUnionSingleItem() { int num = 2; UpdateSketch[] skArr = new UpdateSketch[num]; diff --git a/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java b/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java index 7f40d31f1..8e1aefac7 100644 --- a/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java +++ b/src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java @@ -45,8 +45,6 @@ public class UpdatableSketchWithDoubleSummaryTest { public void isEmpty() { int lgK = 12; DoubleSketch sketch = new DoubleSketch(lgK, mode); -// UpdatableSketch sketch = -// new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode)).build(); Assert.assertTrue(sketch.isEmpty()); Assert.assertFalse(sketch.isEstimationMode()); Assert.assertEquals(sketch.getEstimate(), 0.0); @@ -60,19 +58,27 @@ public void isEmpty() { Assert.assertFalse(it.next()); } + @Test + public void checkLowK() { + UpdatableSketchBuilder bldr = new UpdatableSketchBuilder<>( + new DoubleSummaryFactory(Mode.Sum)); + bldr.setNominalEntries(16); + UpdatableSketch sk = bldr.build(); + assertEquals(sk.getLgK(), 4); + } + @Test public void serDeTest() { int lgK = 12; int K = 1 << lgK; - DoubleSummary.Mode a1Mode = DoubleSummary.Mode.AlwaysOne; - DoubleSketch a1Sk = new DoubleSketch(lgK, a1Mode); + DoubleSketch a1Sk = new DoubleSketch(lgK, Mode.AlwaysOne); int m = 2 * K; for (int key = 0; key < m; key++) { a1Sk.update(key, 1.0); } double est1 = a1Sk.getEstimate(); Memory mem = Memory.wrap(a1Sk.toByteArray()); - DoubleSketch a1Sk2 = new DoubleSketch(mem, a1Mode); + DoubleSketch a1Sk2 = new DoubleSketch(mem, Mode.AlwaysOne); double est2 = a1Sk2.getEstimate(); assertEquals(est1, est2); } @@ -81,8 +87,7 @@ public void serDeTest() { public void checkStringKey() { int lgK = 12; int K = 1 << lgK; - DoubleSummary.Mode a1Mode = DoubleSummary.Mode.AlwaysOne; - DoubleSketch a1Sk1 = new DoubleSketch(lgK, a1Mode); + DoubleSketch a1Sk1 = new DoubleSketch(lgK, Mode.AlwaysOne); int m = K / 2; for (int key = 0; key < m; key++) { a1Sk1.update(Integer.toHexString(key), 1.0);