Skip to content

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leerho committed May 14, 2019
1 parent 1302c06 commit bc8fb20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/yahoo/sketches/theta/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ public double getLowerBound(final int numStdDev) {

/**
* Returns the maximum number of storage bytes required for a CompactSketch with the given
* number of actual entries.
* number of actual entries. Note that this assumes the worse case of the sketch in
* estimation mode, which requires storing theta and count.
* @param numberOfEntries the actual number of entries stored with the CompactSketch.
* @return the maximum number of storage bytes required for a CompactSketch with the given number
* of entries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,15 @@ public void checkConstructReconstructFromMemory() {
}
}

@Test
public void checkNullMemory() {
UpdateSketchBuilder bldr = new UpdateSketchBuilder();
final UpdateSketch sk = bldr.build();
for (int i = 0; i < 1000; i++) { sk.update(i); }
final UpdateSketch shared = bldr.buildSharedFromSketch(sk, null);
assertEquals(shared.getRetainedEntries(), 1000);
assertFalse(shared.hasMemory());
}

//checks Alex's bug where lgArrLongs > lgNomLongs +1.
@Test
Expand Down

0 comments on commit bc8fb20

Please sign in to comment.