You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2019/09/26 21:23:12 UTC

[incubator-datasketches-java] 01/01: update Tests.

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch updateTests
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git

commit 516d4ba30745670df9afbc09eda45e39c82ced80
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Thu Sep 26 14:22:46 2019 -0700

    update Tests.
---
 .../org/apache/datasketches/theta/UnionImplTest.java  |  2 +-
 .../adouble/UpdatableSketchWithDoubleSummaryTest.java | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/test/java/org/apache/datasketches/theta/UnionImplTest.java b/src/test/java/org/apache/datasketches/theta/UnionImplTest.java
index 7c8667b..4354ede 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 class UnionImplTest {
     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 7f40d31..bba138a 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<Double, DoubleSummary> sketch =
-//        new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode)).build();
     Assert.assertTrue(sketch.isEmpty());
     Assert.assertFalse(sketch.isEstimationMode());
     Assert.assertEquals(sketch.getEstimate(), 0.0);
@@ -61,18 +59,26 @@ public class UpdatableSketchWithDoubleSummaryTest {
   }
 
   @Test
+  public void checkLowK() {
+    UpdatableSketchBuilder<Double, DoubleSummary> bldr = new UpdatableSketchBuilder<>(
+        new DoubleSummaryFactory(Mode.Sum));
+    bldr.setNominalEntries(16);
+    UpdatableSketch<Double,DoubleSummary> sk = bldr.build();
+    assertEquals(sk.getLgK(), 16);
+  }
+
+  @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 class UpdatableSketchWithDoubleSummaryTest {
   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);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org