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

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

commit 8b13d168e917b47db13143cda669c80dd2928047
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Tue Feb 4 18:25:44 2025 -0800

    test toByteArray()
---
 .../datasketches/theta/CompactSketchTest.java      | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/datasketches/theta/CompactSketchTest.java 
b/src/test/java/org/apache/datasketches/theta/CompactSketchTest.java
index 0b49f238..05a0e8eb 100644
--- a/src/test/java/org/apache/datasketches/theta/CompactSketchTest.java
+++ b/src/test/java/org/apache/datasketches/theta/CompactSketchTest.java
@@ -589,36 +589,38 @@ public class CompactSketchTest {
 
   @Test
   public void serializeWrapBytesV3() {
-    UpdateSketch sk = Sketches.updateSketchBuilder().build();
+    final UpdateSketch sk = Sketches.updateSketchBuilder().build();
     for (int i = 0; i < 10000; i++) {
       sk.update(i);
     }
-    CompactSketch cs1 = sk.compact();
-    byte[] bytes = cs1.toByteArray();
-    CompactSketch cs2 = new WrappedCompactSketch(bytes);
+    final CompactSketch cs1 = sk.compact();
+    final byte[] bytes = cs1.toByteArray();
+    final CompactSketch cs2 = new WrappedCompactSketch(bytes);
     assertEquals(cs1.getRetainedEntries(), cs2.getRetainedEntries());
-    HashIterator it1 = cs1.iterator();
-    HashIterator it2 = cs2.iterator();
+    final HashIterator it1 = cs1.iterator();
+    final HashIterator it2 = cs2.iterator();
     while (it1.next() && it2.next()) {
       assertEquals(it2.get(), it2.get());
     }
+    assertEquals(bytes, cs2.toByteArray());
   }
 
   @Test
   public void serializeWrapBytesV4() {
-    UpdateSketch sk = Sketches.updateSketchBuilder().build();
+    final UpdateSketch sk = Sketches.updateSketchBuilder().build();
     for (int i = 0; i < 10000; i++) {
       sk.update(i);
     }
-    CompactSketch cs1 = sk.compact();
-    byte[] bytes = cs1.toByteArrayCompressed();
-    CompactSketch cs2 = new WrappedCompactCompressedSketch(bytes);
+    final CompactSketch cs1 = sk.compact();
+    final byte[] bytes = cs1.toByteArrayCompressed();
+    final CompactSketch cs2 = new WrappedCompactCompressedSketch(bytes);
     assertEquals(cs1.getRetainedEntries(), cs2.getRetainedEntries());
-    HashIterator it1 = cs1.iterator();
-    HashIterator it2 = cs2.iterator();
+    final HashIterator it1 = cs1.iterator();
+    final HashIterator it2 = cs2.iterator();
     while (it1.next() && it2.next()) {
       assertEquals(it2.get(), it2.get());
     }
+    assertEquals(bytes, cs2.toByteArray());
   }
 
   private static class State {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to