diff --git a/test/tZarrRead.m b/test/tZarrRead.m index 262c77b..6a2b25b 100644 --- a/test/tZarrRead.m +++ b/test/tZarrRead.m @@ -136,24 +136,35 @@ function invalidFilePath(testcase) function invalidPartialReadParams(testcase) % Verify zarrread errors when invalid partial read - % Start/Stride/Count are used - + % Start/Stride/Count are used. zpath = testcase.ArrPathReadSmall; % a 2D array, 3x4 + % Wrong number of dimensions in comparison to the array errID = 'MATLAB:Zarr:badPartialReadDimensions'; - wrongNumberOfDimensions = [1,1,1]; - testcase.verifyError(... - @()zarrread(zpath,Start=wrongNumberOfDimensions),... - errID); - testcase.verifyError(... - @()zarrread(zpath,Stride=wrongNumberOfDimensions),... - errID); - testcase.verifyError(... - @()zarrread(zpath,Count=wrongNumberOfDimensions),... - errID); - - %TODO: negative values, wrong datatypes, out of bounds - + wrongDims = [1,1,1]; + testcase.verifyError(@()zarrread(zpath,Start=wrongDims),errID); + testcase.verifyError(@()zarrread(zpath,Stride=wrongDims),errID); + testcase.verifyError(@()zarrread(zpath,Count=wrongDims),errID); + + % Invalid type + errID = 'MATLAB:validators:mustBeNumericOrLogical'; + testcase.verifyError(@()zarrread(zpath,"Start",""),errID); + testcase.verifyError(@()zarrread(zpath,"Stride",""),errID); + testcase.verifyError(@()zarrread(zpath,"Count",""),errID); + + % Negative values + inpVal = [-1 1]; + errID = 'MATLAB:validators:mustBePositive'; + testcase.verifyError(@()zarrread(zpath,"Start",inpVal),errID); + testcase.verifyError(@()zarrread(zpath,"Stride",inpVal),errID); + testcase.verifyError(@()zarrread(zpath,"Count",inpVal),errID); + + % Input out of bounds + inpVal = [100 200]; + errID = 'MATLAB:Python:PyException'; + testcase.verifyError(@()zarrread(zpath,"Start",inpVal),errID); + %testcase.verifyError(@()zarrread(zpath,"Stride",inpVal),errID); + testcase.verifyError(@()zarrread(zpath,"Count",inpVal),errID); end end end \ No newline at end of file