@@ -44,16 +44,10 @@ function setup_file(tc)
4444stdlib .h5save(bf , ' /A3' , A3 , " size" , size(A3 ))
4545stdlib .h5save(bf , ' /A4' , A4 )
4646
47- try
48- if ~isMATLABReleaseOlderThan(" R2020b" )
47+ if ~too_old(" R2020b" )
4948stdlib .h5save(bf , " /utf" , utf )
5049stdlib .h5save(bf , " /utf2" , utf2 )
5150end
52- catch e
53- if e .identifier ~= " MATLAB:UndefinedFunction"
54- rethrow(e )
55- end
56- end
5751
5852stdlib .h5save(bf , ' /t/x' , 12 )
5953stdlib .h5save(bf , ' /t/y' , 13 )
@@ -81,15 +75,9 @@ function test_get_variables(tc)
8175v = stdlib .h5variables(basic );
8276k = [" A0" , " A1" , " A2" , " A3" , " A4" ];
8377
84- try
85- if ~isMATLABReleaseOlderThan(" R2020b" )
78+ if ~too_old(" R2020b" )
8679 k = [k , " utf" , " utf2" ];
8780end
88- catch e
89- if e .identifier ~= " MATLAB:UndefinedFunction"
90- rethrow(e )
91- end
92- end
9381
9482tc .verifyEqual(sort(v ), k )
9583
@@ -140,19 +128,13 @@ function test_size(tc)
140128tc .verifyTrue(isvector(s ))
141129tc .verifyEqual(s , [4 ,3 ,2 ,5 ])
142130
143- try
144- if ~isMATLABReleaseOlderThan(" R2020b" )
131+ if ~too_old(" R2020b" )
145132s = stdlib .h5size(basic , ' /utf' );
146133tc .verifyEmpty(s )
147134
148135s = stdlib .h5size(basic , ' /utf2' );
149136tc .verifyEqual(s , 2 )
150137end
151- catch e
152- if e .identifier ~= " MATLAB:UndefinedFunction"
153- rethrow(e )
154- end
155- end
156138
157139end
158140
@@ -182,8 +164,7 @@ function test_read(tc)
182164tc .verifyEqual(ndims(s ), 4 )
183165tc .verifyEqual(s , tc .TestData .A4 )
184166
185- try
186- if ~isMATLABReleaseOlderThan(" R2020b" )
167+ if ~too_old(" R2020b" )
187168s = h5read(basic , ' /utf' );
188169tc .verifyTrue(ischar(s ))
189170tc .verifyEqual(s , tc .TestData .utf )
@@ -192,11 +173,6 @@ function test_read(tc)
192173tc .verifyThat(s , IsOfClass(' string' ))
193174tc .verifyEqual(s , tc .TestData .utf2 )
194175end
195- catch e
196- if e .identifier ~= " MATLAB:UndefinedFunction"
197- rethrow(e )
198- end
199- end
200176
201177end
202178
@@ -219,7 +195,11 @@ function test_shape(tc)
219195function test_coerce(tc , type )
220196basic = tc .TestData .basic ;
221197
222- stdlib .h5save(basic , " /" +type , 0 , " type" ,type )
198+ if any(type == [" string" , " char" ])
199+ tc .assumeFalse(too_old(" R2020b" ))
200+ end
201+
202+ stdlib .h5save(basic , " /" + type , 0 , " type" , type )
223203
224204switch type
225205case " string" , vt = ' char' ;
@@ -265,6 +245,8 @@ function test_int8(tc)
265245
266246function test_string(tc , str )
267247
248+ tc .assumeFalse(too_old(" R2020b" ))
249+
268250basic = tc .TestData .basic ;
269251
270252stdlib .h5save(basic , " /" +str , str )
0 commit comments