1616import java .nio .file .Files ;
1717import java .nio .file .Path ;
1818import java .nio .file .Paths ;
19- import java .util .Arrays ;
2019import java .util .Comparator ;
2120import java .util .stream .Stream ;
2221
22+ import static org .junit .Assert .assertArrayEquals ;
23+ import static org .junit .Assert .assertEquals ;
24+
2325public class ZarrTest {
2426
2527 final Path TESTDATA = Paths .get ("testdata" );
@@ -72,35 +74,33 @@ public void testStores() throws IOException, ZarrException {
7274
7375 @ Test
7476 public void testV3ShardingReadCutout () throws IOException , ZarrException {
75- Array array = Array .open (new FilesystemStore (TESTDATA ).resolve ("l4_sample" , "color" , "1" ));
77+ Array array = Array .open (
78+ new HttpStore ("https://static.webknossos.org/data/zarr_v3" ).resolve ("l4_sample" , "color" , "1" ));
7679
7780 ucar .ma2 .Array outArray = array .read (new long []{0 , 3073 , 3073 , 513 }, new int []{1 , 64 , 64 , 64 });
78- assert outArray .getSize () == 64 * 64 * 64 ;
79- assert outArray .getByte (0 ) == -98 ;
81+ assertEquals ( outArray .getSize (), 64 * 64 * 64 ) ;
82+ assertEquals ( outArray .getByte (0 ), -98 ) ;
8083 }
8184
8285 @ Test
8386 public void testV3ShardingReadWrite () throws IOException , ZarrException {
8487 Array readArray = Array .open (new FilesystemStore (TESTDATA ).resolve ("l4_sample" , "color" , "4-4-1" ));
85- System .out .println ("READ" );
8688 ucar .ma2 .Array readArrayContent = readArray .read ();
8789 Array writeArray = Array .create (new FilesystemStore (TESTOUTPUT ).resolve ("l4_sample_2" , "color" , "4-4-1" ),
8890 ArrayMetadata .builder ().withShape (readArray .metadata .shape ).withDataType (
8991 readArray .metadata .dataType ).withChunkShape (readArray .metadata .chunkShape ()).withFillValue (
9092 readArray .metadata .fillValue ).withCodecs (readArray .metadata .codecs ).build ());
91- System .out .println ("WRITE" );
9293 writeArray .write (readArrayContent );
93- System .out .println ("READ" );
9494 ucar .ma2 .Array outArray = writeArray .read ();
9595
9696 assert MultiArrayUtils .allValuesEqual (outArray , readArrayContent );
9797 }
9898
9999 @ Test
100100 public void testV3FillValue () throws ZarrException {
101- assert ( int ) ArrayMetadata .parseFillValue (0 , DataType .UINT32 ) == 0 ;
102- assert ( int ) ArrayMetadata .parseFillValue ("0x00010203" , DataType .UINT32 ) == 50462976 ;
103- assert ( byte ) ArrayMetadata .parseFillValue ("0b00000010" , DataType .UINT8 ) == 2 ;
101+ assertEquals (( int ) ArrayMetadata .parseFillValue (0 , DataType .UINT32 ), 0 ) ;
102+ assertEquals (( int ) ArrayMetadata .parseFillValue ("0x00010203" , DataType .UINT32 ), 50462976 ) ;
103+ assertEquals (( byte ) ArrayMetadata .parseFillValue ("0b00000010" , DataType .UINT8 ), 2 ) ;
104104 assert Double .isNaN ((double ) ArrayMetadata .parseFillValue ("NaN" , DataType .FLOAT64 ));
105105 assert Double .isInfinite ((double ) ArrayMetadata .parseFillValue ("-Infinity" , DataType .FLOAT64 ));
106106 }
@@ -116,8 +116,7 @@ public void testV3Group() throws IOException, ZarrException {
116116 5 ).withFillValue (0 ).build ());
117117 array .write (new long []{2 , 2 }, ucar .ma2 .Array .factory (ucar .ma2 .DataType .UBYTE , new int []{8 , 8 }));
118118
119- assert Arrays .equals (((Array ) ((Group ) group .list ()[0 ]).list ()[0 ]).metadata .chunkShape (),
120- new int []{5 , 5 });
119+ assertArrayEquals (((Array ) ((Group ) group .list ()[0 ]).list ()[0 ]).metadata .chunkShape (), new int []{5 , 5 });
121120 }
122121
123122 @ Test
0 commit comments