-
Notifications
You must be signed in to change notification settings - Fork 2
Updated tests with new error IDs #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
branches: | ||
- main | ||
- branch-bug | ||
- update-test-branch | ||
|
||
jobs: | ||
test: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,31 +21,31 @@ function invalidFilePath(testcase) | |
testcase.verifyError(@()zarrcreate([],testcase.ArrSize),errID); | ||
end | ||
|
||
% function pathContainingInvalidChars(testcase) | ||
% % Verify error when the array or group name contains | ||
% % unsupported characters. | ||
% TOCHECK: Failure on Linux | ||
% testcase.verifyError(@()zarrcreate('grp*/arr',testcase.ArrSize),testcase.PyException); | ||
% testcase.verifyError(@()zarrcreate('grp/arr*',testcase.ArrSize),testcase.PyException); | ||
% end | ||
function pathContainingInvalidChars(testcase) | ||
% Verify error when the array or group name contains | ||
% unsupported characters. | ||
testcase.assumeTrue(ispc,'Filtered on other platforms'); | ||
testcase.verifyError(@()zarrcreate('grp*/arr',testcase.ArrSize),testcase.PyException); | ||
testcase.verifyError(@()zarrcreate('grp/arr*',testcase.ArrSize),testcase.PyException); | ||
end | ||
|
||
function chunkSizeGreaterThanArraySize(testcase) | ||
% Verify error when the chunk size is greater than the array | ||
% size. | ||
testcase.assumeTrue(false,'Filtered until the issue is fixed.'); | ||
errID = 'MATLAB:zarrcreate:chunkSizeGreater'; | ||
chunkSize = [30 35]; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
'ChunkSize',chunkSize),testcase.PyException); | ||
'ChunkSize',chunkSize),errID); | ||
end | ||
|
||
function chunkSizeMismatch(testcase) | ||
% Verify error when there is a mismatch between Array size and | ||
% Chunk size. | ||
testcase.assumeTrue(false,'Filtered until issue 25 is fixed.'); | ||
arrSize = [10 12 5]; | ||
chunkSize = [4 5]; | ||
errID = 'MATLAB:zarrcreate:chunkDimsMismatch'; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,arrSize, ... | ||
'ChunkSize',chunkSize),testcase.PyException); | ||
'ChunkSize',chunkSize),errID); | ||
end | ||
|
||
function invalidClevelBlosc(testcase) | ||
|
@@ -124,8 +124,6 @@ function invalidChunkSize(testcase) | |
|
||
function invalidFillValue(testcase) | ||
% Verify error when an invalid type for the fill value is used. | ||
% testcase.verifyError(@()zarrcreate(testcase.FilePath,testcase.ArrSize, ... | ||
% "FillValue",[]),testcase.PyException); | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
"FillValue",[-9 -9]),testcase.PyException); | ||
% testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
|
@@ -138,15 +136,20 @@ function invalidSizeInput(testcase) | |
% Verify error when an invalid size input is used. | ||
% testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,[]), ... | ||
% testcase.PyException); | ||
|
||
end | ||
|
||
function invalidCompressionInputType(testcase) | ||
% Verify error when an invalid compression value is used. | ||
testcase.assumeTrue(false,'Filtered until the issue is fixed.'); | ||
%testcase.assumeTrue(false,'Filtered until the issue is fixed.'); | ||
comp.id = 'random'; | ||
errID = 'MATLAB:Zarr:invalidCompressionID'; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
'Compression',comp),testcase.PyException); | ||
'Compression',comp),errID); | ||
|
||
comp = 'zlib'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment here for this test? |
||
errID = 'MATLAB:zarrcreate:invalidCompression'; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
'Compression',comp),errID); | ||
end | ||
|
||
function invalidCompressionMember(testcase) | ||
|
@@ -168,6 +171,11 @@ function invalidCompressionMember(testcase) | |
function zlibInvalidCompressionLevel(testcase) | ||
% Verify error when an invalid compression level is used. | ||
% For zlib, valid values are [0 9] | ||
comp.level = 5; | ||
errID = 'MATLAB:Zarr:missingCompressionID'; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
'Compression',comp),errID); | ||
|
||
comp.id = 'zlib'; | ||
comp.level = -1; | ||
testcase.verifyError(@()zarrcreate(testcase.ArrPathWrite,testcase.ArrSize, ... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,9 +59,23 @@ function createArrayRemoteUserDefinedSyntax(testcase) | |
% Move to a separate file | ||
end | ||
|
||
function createArrayWithBlosc(testcase) | ||
function createArrayWithDefaultBloscConfig(testcase) | ||
% Verify data when creating and writing to a Zarr array using | ||
% blosc compression. | ||
% a default blosc compression configuration. | ||
comp.id = 'blosc'; | ||
expData = randn(testcase.ArrSize); | ||
|
||
zarrcreate(testcase.ArrPathWrite,testcase.ArrSize,'ChunkSize', ... | ||
testcase.ChunkSize,'Compression',comp); | ||
zarrwrite(testcase.ArrPathWrite,expData); | ||
|
||
actData = zarrread(testcase.ArrPathWrite); | ||
testcase.verifyEqual(actData,expData,'Failed to verify data.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also test if the correct compression was used (using zarrinfo)? |
||
end | ||
|
||
function createArrayWithCustomBloscConfig(testcase) | ||
% Verify data when creating and writing to a Zarr array using | ||
% custom blosc compression configuration. | ||
comp.id = 'blosc'; | ||
comp.clevel = 5; | ||
cname = {'blosclz','lz4','lz4hc','zlib','zstd','snappy'}; | ||
|
@@ -79,6 +93,25 @@ function createArrayWithBlosc(testcase) | |
end | ||
end | ||
|
||
function createArrayWithDefaultCompConfig(testcase) | ||
% Verify data when creating and writing to a Zarr array using | ||
% a default compression (other than Blosc) configuration. | ||
compType = {'zlib','gzip','bz2','zstd'}; | ||
expData = randn(testcase.ArrSize); | ||
|
||
for i = 1:length(compType) | ||
comp.id = compType{i}; | ||
|
||
zarrcreate(testcase.ArrPathWrite,testcase.ArrSize,'ChunkSize', ... | ||
testcase.ChunkSize,'Compression',comp); | ||
zarrwrite(testcase.ArrPathWrite,expData); | ||
|
||
actData = zarrread(testcase.ArrPathWrite); | ||
testcase.verifyEqual(actData,expData,'Failed to verify data.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also test if the correct compression was used (using zarrinfo)? |
||
end | ||
end | ||
|
||
|
||
function tooFewInputs(testcase) | ||
% Verify error when too few inputs to zarrwrite are passed. | ||
errID = 'MATLAB:minrhs'; | ||
|
@@ -105,8 +138,7 @@ function invalidFilePath(testcase) | |
function dataDimensionMismatch(testcase) | ||
% Verify error when there is a dimension mismatch at the time of | ||
% writing to the array. | ||
testcase.assumeTrue(false,'Filtered until error ID is added.'); | ||
errID = ''; | ||
errID = 'MATLAB:Zarr:sizeMismatch'; | ||
zarrcreate(testcase.ArrPathWrite,testcase.ArrSize); | ||
data = ones(30,30); | ||
testcase.verifyError(@()zarrwrite(testcase.ArrPathWrite,data),errID); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this get get cleaned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WorkingFolderFixture automatically takes care of it. See https://www.mathworks.com/help/matlab/ref/matlab.unittest.fixtures.workingfolderfixture-class.html#bu2oxjj-2