Skip to content

Commit adc27b1

Browse files
committed
test hdf4
1 parent 1f9e408 commit adc27b1

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

+stdlib/h4exists.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
% * variable: path of variable in file
77
%%% Outputs
88
% * exists: boolean
9-
arguments
10-
file
11-
variable (1,1) string
12-
end
9+
% arguments
10+
% file
11+
% variable (1,1) string
12+
% end
1313

14-
sds = hdfinfo(file).SDS;
14+
finf = hdfinfo(file);
15+
sds = finf.SDS;
1516
exists = ismember(variable, sds.Name);
1617

1718
end

+stdlib/h4size.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
% fsize: vector of variable size per dimension. Empty if scalar variable.
88

99
function fsize = h4size(file, variable)
10-
arguments
11-
file
12-
variable (1,1) string
13-
end
10+
% arguments
11+
% file
12+
% variable (1,1) string
13+
% end
1414

15-
sds = hdfinfo(file).SDS;
15+
finf = hdfinfo(file);
16+
sds = finf.SDS;
1617

17-
i = {sds.Name} == variable;
18+
i = strcmp({sds.Name}, variable);
1819
if ~any(i)
1920
error(variable + " is not an SDS in " + file)
2021
end

test/TestHDF4.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2019b', 'hdf4'}) ...
2+
TestTags = {'R2017b', 'hdf4'}) ...
33
TestHDF4 < matlab.unittest.TestCase
44

55
properties
@@ -8,7 +8,7 @@
88

99
methods (TestClassSetup)
1010
function check_file(tc)
11-
tc.assumeThat(tc.file, matlab.unittest.constraints.IsFile)
11+
tc.assumeTrue(isfile(tc.file), "HDF4 file not found: " + tc.file)
1212
end
1313
end
1414

0 commit comments

Comments
 (0)