|
1 | 1 | classdef TestWithSuffix < matlab.unittest.TestCase |
2 | 2 |
|
| 3 | +properties |
| 4 | +is_mex = stdlib.is_mex_fun("stdlib.parent") |
| 5 | +end |
| 6 | + |
3 | 7 | properties (TestParameter) |
4 | | -p = {{"foo.h5", ".nc", "foo\.nc"},... |
| 8 | +p = {{"foo.h5", ".nc", "foo.nc"},... |
5 | 9 | {"c", "", "c"}, ... |
6 | 10 | {"c.nc", "", "c"}, ... |
7 | | -{"", ".nc", "\.nc"}, ... |
8 | | -{"a/b/c/", ".h5", "a/b/c/\.h5"}, ... |
9 | | -{"a/b/.h5", ".nc", "a/b/\.h5\.nc"}, ... |
10 | | -{'a/b', '.nc', 'a/b\.nc'}}; |
| 11 | +{"", ".nc", ".nc"}, ... |
| 12 | +{'a/b/c/', '.h5', 'a/b/c/.h5'}, ... |
| 13 | +{"a/b/.h5", '.nc', "a/b/.h5.nc"}, ... |
| 14 | +{'a/b', '.nc', 'a/b.nc'}}; |
11 | 15 | end |
12 | 16 |
|
13 | 17 | methods (Test) |
14 | 18 | function test_with_suffix(tc, p) |
15 | | -import matlab.unittest.constraints.Matches |
16 | | -tc.verifyThat(stdlib.with_suffix(p{1}, p{2}), Matches(p{3})) |
| 19 | + |
| 20 | +if tc.is_mex |
| 21 | + r = string(p{3}); |
| 22 | +else |
| 23 | + r = p{3}; |
| 24 | +end |
| 25 | + |
| 26 | +tc.verifyEqual(stdlib.with_suffix(p{1}, p{2}), r, ... |
| 27 | + sprintf("mex: %d", tc.is_mex)) |
17 | 28 | end |
18 | 29 | end |
19 | 30 |
|
|
0 commit comments