leerho commented on a change in pull request #324:
URL:
https://github.com/apache/incubator-datasketches-java/pull/324#discussion_r452626358
##########
File path: src/test/java/org/apache/datasketches/theta/CompactSketchTest.java
##########
@@ -222,22 +216,80 @@ public void checkMemTooSmallOrdered() {
@Test
public void checkCompactCachePart() {
//phony values except for curCount = 0.
- long[] result = CompactSketch.compactCachePart(null, 4, 0, 0L, false);
+ long[] result = IntersectionImplR.compactCachePart(null, 4, 0, 0L, false);
assertEquals(result.length, 0);
}
@Test
public void checkDirectCompactSingleItemSketch() {
+ State state;
UpdateSketch sk = Sketches.updateSketchBuilder().build();
- CompactSketch csk = sk.compact(true, WritableMemory.allocate(16));
- int bytes = csk.getCurrentBytes(true);
- assertEquals(bytes, 8);
+
+ CompactSketch csko; //ordered
+ CompactSketch csku; //unordered
+
+ WritableMemory wmem = WritableMemory.allocate(16);
+ csko = sk.compact(true, wmem); //empty, direct, ordered
+ //ClassType, Count, Bytes, Compact, Empty, Direct, Memory, Ordered,
Estimation
+ state = new State("DirectCompactSketch", 0, 8, true, true, false, true,
true, false);
+ state.check(csko);
+
+ wmem = WritableMemory.allocate(16);
+ csku = sk.compact(false, wmem); //empty, direct, unordered
+ state = new State("DirectCompactSketch", 0, 8, true, true, false, true,
true, false);
+ state.check(csku);
+
sk.update(1);
- csk = sk.compact(true, WritableMemory.allocate(16));
- bytes = csk.getCurrentBytes(true);
- assertEquals(bytes, 16);
- assertTrue(csk == csk.compact());
- assertTrue(csk == csk.compact(true, null));
+ wmem = WritableMemory.allocate(16);
+ csko = sk.compact(true, wmem); //Single, direct, ordered
+ state = new State("DirectCompactSketch", 1, 16, true, false, false, true,
true, false);
+ state.check(csko);
+
+ wmem = WritableMemory.allocate(16);
+ csku = sk.compact(false, wmem); //Single, direct, unordered
+ state = new State("DirectCompactSketch", 1, 16, true, false, false, true,
true, false);
+ state.check(csku);
+
+ CompactSketch csk2o; //ordered
+ CompactSketch csk2u; //unordered
+
+ csk2o = csku.compact(); //single, heap, ordered
+ state = new State("SingleItemSketch", 1, 16, true, false, false, false,
true, false);
+ state.check(csk2o);
+
+ csk2o = csku.compact(true, null); //single, heap, ordered
+ state.check(csk2o);
+
+ csk2o = csku.compact(false, null); //single, heap, ordered
+ state.check(csk2o);
+
+ csk2o = csko.compact(true, null); //single, heap, ordered
+ state.check(csk2o);
+
+ csk2o = csko.compact(false, null); //single, heap, ordered
Review comment:
Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]