@@ -230,23 +230,35 @@ 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-
233+ @ ParameterizedTest
234+ @ ValueSource (strings = {"large" , "small" , "nested" , "wrong dims" , "correct" })
235+ public void testCheckShardingBounds (String scenario ) throws Exception {
237236 long [] shape = new long [] {4 , 4 };
238- int [] shardSize = new int [] {1 , 1 };
237+ int [] shardSize = new int [] {2 , 2 };
239238 int [] chunkSize = new int [] {2 , 2 };
240239
240+ if (scenario .equals ("large" ))
241+ shardSize = new int [] {8 , 8 };
242+ if (scenario .equals ("small" ))
243+ shardSize = new int [] {1 , 1 };
244+ if (scenario .equals ("wrong dims" ))
245+ shardSize = new int [] {1 };
241246 StoreHandle storeHandle = new FilesystemStore (TESTOUTPUT ).resolve ("illegal_shardsize" );
242247 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 );
248+ .withShape (shape )
249+ .withDataType (DataType .UINT32 ).withChunkShape (shardSize );
250+
251+ if (scenario .equals ("nested" )) {
252+ int [] nestedChunkSize = new int []{4 , 4 };
253+ builder = builder .withCodecs (c -> c .withSharding (chunkSize , c1 -> c1 .withSharding (nestedChunkSize , c2 -> c2 .withBytes ("LITTLE" ))));
254+ } else {
255+ builder = builder .withCodecs (c -> c .withSharding (chunkSize , c1 -> c1 .withBytes ("LITTLE" )));
256+ }
257+ if (scenario .equals ("correct" )){
258+ builder .build ();
259+ }else {
260+ assertThrows (ZarrException .class , builder ::build );
261+ }
250262 }
251263
252264 @ ParameterizedTest
0 commit comments