Skip to content

Commit 516d4ba

Browse files
committed
update Tests.
1 parent 13e5ef8 commit 516d4ba

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

src/test/java/org/apache/datasketches/theta/UnionImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public void checkCompactFlagCorruption() {
223223
println(""+csk1.getEstimate());
224224
}
225225

226-
@Test
226+
@Test //checks for bug introduced in 1.0.0-incubating.
227227
public void checkDirectUnionSingleItem() {
228228
int num = 2;
229229
UpdateSketch[] skArr = new UpdateSketch[num];

src/test/java/org/apache/datasketches/tuple/adouble/UpdatableSketchWithDoubleSummaryTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public class UpdatableSketchWithDoubleSummaryTest {
4545
public void isEmpty() {
4646
int lgK = 12;
4747
DoubleSketch sketch = new DoubleSketch(lgK, mode);
48-
// UpdatableSketch<Double, DoubleSummary> sketch =
49-
// new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode)).build();
5048
Assert.assertTrue(sketch.isEmpty());
5149
Assert.assertFalse(sketch.isEstimationMode());
5250
Assert.assertEquals(sketch.getEstimate(), 0.0);
@@ -60,19 +58,27 @@ public void isEmpty() {
6058
Assert.assertFalse(it.next());
6159
}
6260

61+
@Test
62+
public void checkLowK() {
63+
UpdatableSketchBuilder<Double, DoubleSummary> bldr = new UpdatableSketchBuilder<>(
64+
new DoubleSummaryFactory(Mode.Sum));
65+
bldr.setNominalEntries(16);
66+
UpdatableSketch<Double,DoubleSummary> sk = bldr.build();
67+
assertEquals(sk.getLgK(), 16);
68+
}
69+
6370
@Test
6471
public void serDeTest() {
6572
int lgK = 12;
6673
int K = 1 << lgK;
67-
DoubleSummary.Mode a1Mode = DoubleSummary.Mode.AlwaysOne;
68-
DoubleSketch a1Sk = new DoubleSketch(lgK, a1Mode);
74+
DoubleSketch a1Sk = new DoubleSketch(lgK, Mode.AlwaysOne);
6975
int m = 2 * K;
7076
for (int key = 0; key < m; key++) {
7177
a1Sk.update(key, 1.0);
7278
}
7379
double est1 = a1Sk.getEstimate();
7480
Memory mem = Memory.wrap(a1Sk.toByteArray());
75-
DoubleSketch a1Sk2 = new DoubleSketch(mem, a1Mode);
81+
DoubleSketch a1Sk2 = new DoubleSketch(mem, Mode.AlwaysOne);
7682
double est2 = a1Sk2.getEstimate();
7783
assertEquals(est1, est2);
7884
}
@@ -81,8 +87,7 @@ public void serDeTest() {
8187
public void checkStringKey() {
8288
int lgK = 12;
8389
int K = 1 << lgK;
84-
DoubleSummary.Mode a1Mode = DoubleSummary.Mode.AlwaysOne;
85-
DoubleSketch a1Sk1 = new DoubleSketch(lgK, a1Mode);
90+
DoubleSketch a1Sk1 = new DoubleSketch(lgK, Mode.AlwaysOne);
8691
int m = K / 2;
8792
for (int key = 0; key < m; key++) {
8893
a1Sk1.update(Integer.toHexString(key), 1.0);

0 commit comments

Comments
 (0)