Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions test/tZarrRead.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment here that the number of dimensions is wrong? I understand making the variable name shorter, but without that information it can be hard to quickly figure out what is "wrong" about these dimensions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated comment.

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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this one commented out?

testcase.verifyError(@()zarrread(zpath,"Count",inpVal),errID);
end
end
end