Skip to content

Commit 4304f2d

Browse files
committed
test check sharding bounds
1 parent bdb1bb8 commit 4304f2d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/java/dev/zarr/zarrjava/ZarrTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,25 @@ public void testWriteReadWithZarrita(String codec, String codecParam) throws Exc
230230
assert exitCode == 0;
231231
}
232232

233+
@Test
234+
public void testCheckShardingBounds() throws Exception {
235+
//TODO: test too big, too small, wrong dims
236+
237+
long[] shape = new long[] {4, 4};
238+
int[] shardSize = new int[] {1, 1};
239+
int[] chunkSize = new int[] {2, 2};
240+
241+
StoreHandle storeHandle = new FilesystemStore(TESTOUTPUT).resolve("illegal_shardsize");
242+
ArrayMetadataBuilder builder = Array.metadataBuilder()
243+
.withShape(shape)
244+
.withDataType(DataType.UINT32)
245+
.withChunkShape(shardSize)
246+
//TODO: parametrized test with different wrong chunksizes
247+
.withCodecs(c -> c.withSharding(chunkSize, c1 -> c1.withBytes("LITTLE")));
248+
249+
assertThrows(ZarrException.class, builder::build);
250+
}
251+
233252
@ParameterizedTest
234253
@CsvSource({"0,true", "0,false", "5, true", "5, false"})
235254
public void testZstdCodecReadWrite(int clevel, boolean checksum) throws ZarrException, IOException {

0 commit comments

Comments
 (0)