@Test public void checkUnionNulls() { DoublesUnion union = new HeapDoublesUnion(128); DoublesSketch sk1 = union.getResultAndReset(); DoublesSketch sk2 = union.getResultAndReset(); assertNull(sk1); assertNull(sk2); union.update(sk2); DoublesSketch sk3 = union.getResultAndReset(); assertNull(sk3); }
@Test public void updateWithDoubleValueOnly() { DoublesUnion union = DoublesUnion.builder().build(); union.update(123.456); DoublesSketch qs = union.getResultAndReset(); assertEquals(qs.getN(), 1); }
@Test // (expectedExceptions = SketchesStateException.class) public void checkResultAndReset() { DoublesSketch qs1 = buildQS(256, 0); DoublesUnion union = DoublesUnion.builder().build(qs1); DoublesSketch qs2 = union.getResultAndReset(); assertEquals(qs2.getK(), 256); }