Skip to content

Commit b66044f

Browse files
committed
Revert "test: remove unused logic"
This reverts commit 1904550.
1 parent f9cf381 commit b66044f

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

Readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Matlab or
1010
users coming from other languages will benefit from the functionality contained within this user-developed, unofficial "stdlib" standard library of functions.
1111
These system, filesystem, and HDF5 / HDF4 / NetCDF functions are used across numerous projects.
1212

13-
Matlab R2020b is the minimum required version.
13+
Matlab R2019b is the minimum required due to use of
14+
[arguments](https://www.mathworks.com/help/matlab/ref/arguments.html)
15+
syntax.
1416
URLs (e.g. https://, s3:// and similar) are treated as not existing.
1517
The self-tests require at least Matlab R2021b and can be run from the matlab-stdlib/ directory.
1618

test/TestHDF5.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ function setup_file(tc)
5353
stdlib.h5save(tc.file, '/A3', tc.A3, size=size(tc.A3))
5454
stdlib.h5save(tc.file, '/A4', tc.A4)
5555

56+
if ~isMATLABReleaseOlderThan("R2020b")
5657
stdlib.h5save(tc.file, "/utf", tc.utf)
5758
stdlib.h5save(tc.file, "/utf2", tc.utf2)
59+
end
5860

5961
stdlib.h5save(tc.file, '/t/x', 12)
6062
stdlib.h5save(tc.file, '/t/y', 13)
@@ -87,7 +89,11 @@ function test_auto_chunk_size(tc)
8789
function test_get_variables(tc)
8890

8991
v = stdlib.h5variables(tc.file);
90-
k = ["A0", "A1", "A2", "A3", "A4", "utf", "utf2"];
92+
k = ["A0", "A1", "A2", "A3", "A4"];
93+
94+
if ~isMATLABReleaseOlderThan("R2020b")
95+
k = [k, "utf", "utf2"];
96+
end
9197

9298
tc.verifyEqual(sort(v), k)
9399

@@ -136,11 +142,13 @@ function test_size(tc)
136142
tc.verifyTrue(isvector(s))
137143
tc.verifyEqual(s, [4,3,2,5])
138144

145+
if ~isMATLABReleaseOlderThan("R2020b")
139146
s = stdlib.h5size(tc.file, '/utf');
140147
tc.verifyEmpty(s)
141148

142149
s = stdlib.h5size(tc.file, '/utf2');
143150
tc.verifyEqual(s, 2)
151+
end
144152

145153
end
146154

@@ -169,13 +177,15 @@ function test_read(tc)
169177
tc.verifyEqual(ndims(s), 4)
170178
tc.verifyEqual(s, tc.A4)
171179

180+
if ~isMATLABReleaseOlderThan("R2020b")
172181
s = h5read(tc.file, '/utf');
173182
tc.verifyTrue(ischar(s))
174183
tc.verifyEqual(s, tc.utf)
175184

176185
s = h5read(tc.file, '/utf2');
177186
tc.verifyClass(s, 'string')
178187
tc.verifyEqual(s, tc.utf2)
188+
end
179189

180190
end
181191

@@ -195,6 +205,10 @@ function test_shape(tc)
195205

196206
function test_coerce(tc, type)
197207

208+
if any(type == ["string", "char"])
209+
tc.assumeFalse(isMATLABReleaseOlderThan("R2020b"))
210+
end
211+
198212
stdlib.h5save(tc.file, "/" + type, 0, "type", type)
199213

200214
switch type
@@ -235,6 +249,8 @@ function test_int8(tc)
235249

236250
function test_string(tc, str)
237251

252+
tc.assumeFalse(isMATLABReleaseOlderThan("R2020b"))
253+
238254
stdlib.h5save(tc.file, "/"+str, str)
239255

240256
a = h5read(tc.file, "/"+str);

test/TestNetCDF.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ function setup_file(tc)
4646
stdlib.ncsave(tc.file, 'A3', tc.A3, "dims", {'x3', size(tc.A3,1), 'y3', size(tc.A3,2), 'z3', size(tc.A3,3)})
4747
stdlib.ncsave(tc.file, 'A4', tc.A4, "dims", {'x4', size(tc.A4,1), 'y4', size(tc.A4,2), 'z4', size(tc.A4,3), 'w4', size(tc.A4,4)})
4848

49+
if ~isMATLABReleaseOlderThan('R2021b')
4950
stdlib.ncsave(tc.file, "utf0", tc.utf0)
5051
stdlib.ncsave(tc.file, "utf1", tc.utf1, "dims", {'s1', size(tc.utf1, 1)})
5152
stdlib.ncsave(tc.file, "utf2", tc.utf2, "dims", {'s1', size(tc.utf2, 1), 't1', size(tc.utf2, 2)})
53+
end
5254

5355
stdlib.ncsave(tc.file, '/t/x', 12)
5456
stdlib.ncsave(tc.file, '/t/y', 13)
@@ -73,7 +75,11 @@ function remove_temp_wd(tc)
7375
function test_get_variables(tc)
7476

7577

76-
k = ["A0", "A1", "A2", "A3", "A4", "utf0", "utf1", "utf2"];
78+
k = ["A0", "A1", "A2", "A3", "A4"];
79+
80+
if ~isMATLABReleaseOlderThan('R2021b')
81+
k = [k, ["utf0", "utf1", "utf2"]];
82+
end
7783

7884
tc.verifyEqual(sort(stdlib.ncvariables(tc.file)), k)
7985

@@ -130,6 +136,7 @@ function test_size(tc)
130136

131137
function test_size_string(tc)
132138

139+
tc.assumeFalse(isMATLABReleaseOlderThan('R2021b'), "NetCDF4 string requires Matlab >= R2021b")
133140

134141
s = stdlib.ncsize(tc.file, 'utf0');
135142
tc.verifyEmpty(s)
@@ -169,6 +176,7 @@ function test_read(tc)
169176

170177
function test_read_string(tc)
171178

179+
tc.assumeFalse(isMATLABReleaseOlderThan('R2021b'), "NetCDF4 string requires Matlab >= R2021b")
172180

173181
s = ncread(tc.file, 'utf0');
174182
tc.verifyClass(s, 'string')

0 commit comments

Comments
 (0)