Skip to content

Commit

Permalink
Extend test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
btreeby committed Jun 4, 2023
1 parent 840786c commit 1b53e71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion +h5tools/delete.m
Expand Up @@ -23,5 +23,6 @@ function delete(filename, location)
H5L.delete(fid, location, 'H5P_DEFAULT');
H5F.close(fid);
else
warning('Specified location doesn''t exist.');
wid = 'h5tools:locationNotFound';
warning(wid, 'Specified location doesn''t exist.');
end
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
runTestsLocal.m
code-coverage
test-results
14 changes: 10 additions & 4 deletions tests/test_copyGroup.m
Expand Up @@ -79,11 +79,17 @@ function testInvalidInput(testCase)
'h5tools:wrongExtension');
end

% Delete the dataset from the second file, and verify it doesn't
% exist after delete.
% Delete the dataset, and verify it doesn't exist after delete.
function testDeleteDataset(testCase)
h5tools.delete(testCase.toFile, ['/' testCase.groupFile1 '/' testCase.datasetFile1]);
testCase.verifyEqual(h5tools.exists(testCase.toFile, ['/' testCase.groupFile1 '/' testCase.datasetFile1]), false);
h5tools.delete(testCase.fromFile, ['/' testCase.groupFile1 '/' testCase.datasetFile1]);
testCase.verifyEqual(h5tools.exists(testCase.fromFile, ['/' testCase.groupFile1 '/' testCase.datasetFile1]), false);
end

% Try to delete a missing dataset, and verify warning.
function testDeleteMissingDataset(testCase)
testCase.verifyWarning( ...
@() h5tools.delete(testCase.toFile, ['/' testCase.groupFile1 '/' testCase.datasetFile1]), ...
'h5tools:locationNotFound');
end

end
Expand Down

0 comments on commit 1b53e71

Please sign in to comment.