Skip to content

Commit c4e2b31

Browse files
committed
test:root < R2021a too
1 parent 1b631ce commit c4e2b31

File tree

1 file changed

+49
-42
lines changed

1 file changed

+49
-42
lines changed

test/TestRoot.m

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2021a', 'pure'}) ...
2+
TestTags = {'R2019b', 'pure'}) ...
33
TestRoot < matlab.unittest.TestCase
44

55
properties (TestParameter)
6-
p
7-
rn
8-
rd
6+
p = init_root()
7+
rn = init_rn()
8+
rd = init_rd()
99
end
1010

1111

12-
methods (TestParameterDefinition, Static)
13-
function [p, rn, rd] = init_root()
12+
methods (Test)
13+
14+
function test_root(tc, p)
15+
r = stdlib.root(p{1});
16+
tc.assertClass(r, 'string')
17+
tc.verifyEqual(r, p{2})
18+
end
19+
20+
function test_root_dir(tc, rd)
21+
r = stdlib.root_dir(rd{1});
22+
tc.assertClass(r, 'string')
23+
tc.verifyEqual(r, rd{2}, "root_dir(" + rd{1} + ")")
24+
end
25+
26+
function test_root_name(tc, rn)
27+
r = stdlib.root_name(rn{1});
28+
tc.assertClass(r, 'string')
29+
tc.verifyEqual(r, rn{2})
30+
end
31+
32+
end
33+
34+
end
35+
36+
37+
function p = init_root()
1438

1539
p = {{"", ""}, ...
1640
{"a/b", ""}, ...
@@ -22,55 +46,38 @@
2246
{'c:\etc', ""}};
2347

2448
if ispc()
25-
p{6}{2} = "c:";
26-
p{7}{2} = "c:/";
27-
p{8}{2} = "c:\";
49+
p{6}{2} = "c:";
50+
p{7}{2} = "c:/";
51+
p{8}{2} = "c:\";
2852
end
2953

30-
rn = p;
54+
end
3155

32-
rn{4}{2} = "";
33-
rn{5}{2} = "";
3456

35-
if ispc()
36-
rn{6}{2} = "c:";
37-
rn{7}{2} = "c:";
38-
rn{8}{2} = "c:";
39-
end
57+
function p = init_rn()
4058

41-
rd = p;
59+
p = init_root();
60+
61+
p{4}{2} = "";
62+
p{5}{2} = "";
4263

4364
if ispc()
44-
rd{6}{2} = "";
45-
rd{7}{2} = "/";
46-
rd{8}{2} = "\";
65+
p{6}{2} = "c:";
66+
p{7}{2} = "c:";
67+
p{8}{2} = "c:";
4768
end
4869

4970
end
5071

51-
end
5272

73+
function p = init_rd()
5374

54-
methods (Test)
55-
56-
function test_root(tc, p)
57-
r = stdlib.root(p{1});
58-
tc.assertClass(r, 'string')
59-
tc.verifyEqual(r, p{2})
60-
end
61-
62-
function test_root_dir(tc, rd)
63-
r = stdlib.root_dir(rd{1});
64-
tc.assertClass(r, 'string')
65-
tc.verifyEqual(r, rd{2}, "root_dir(" + rd{1} + ")")
66-
end
67-
68-
function test_root_name(tc, rn)
69-
r = stdlib.root_name(rn{1});
70-
tc.assertClass(r, 'string')
71-
tc.verifyEqual(r, rn{2})
72-
end
75+
p = init_root();
7376

77+
if ispc()
78+
p{6}{2} = "";
79+
p{7}{2} = "/";
80+
p{8}{2} = "\";
7481
end
7582

76-
end
83+
end

0 commit comments

Comments
 (0)