|
13 | 13 |
|
14 | 14 | import java.io.IOException; |
15 | 15 | import java.io.InputStream; |
| 16 | +import java.nio.ByteBuffer; |
16 | 17 | import java.util.List; |
17 | 18 | import java.util.Set; |
18 | 19 | import java.util.stream.Collectors; |
@@ -79,6 +80,26 @@ public void testGetSize() { |
79 | 80 | Assertions.assertEquals(actual_size, size); |
80 | 81 | } |
81 | 82 |
|
| 83 | + @Test |
| 84 | + public void testGetWithStartEnd() { |
| 85 | + StoreHandle storeHandle = storeHandleWithData(); |
| 86 | + long size = storeHandle.getSize(); |
| 87 | + System.out.println("Store size: " + size); |
| 88 | + if (size < 20) { |
| 89 | + Assertions.fail("Store size is too small to test get with start and end"); |
| 90 | + } |
| 91 | + ByteBuffer buffer = storeHandle.read(5, 15); |
| 92 | + Assertions.assertEquals(10, buffer.remaining()); |
| 93 | + |
| 94 | + ByteBuffer fullBuffer = storeHandle.read(); |
| 95 | + byte[] expectedBytes = new byte[10]; |
| 96 | + fullBuffer.position(5); |
| 97 | + fullBuffer.get(expectedBytes, 0, 10); |
| 98 | + byte[] actualBytes = new byte[10]; |
| 99 | + buffer.get(actualBytes, 0, 10); |
| 100 | + Assertions.assertArrayEquals(expectedBytes, actualBytes); |
| 101 | + } |
| 102 | + |
82 | 103 | @Test |
83 | 104 | public abstract void testList() throws ZarrException, IOException; |
84 | 105 |
|
|
0 commit comments