11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(" .." )}, ...
2- TestTags = {' R2019b ' , ' pure' }) ...
2+ TestTags = {' R2021a ' , ' pure' }) ...
33 TestRoot < matlab .unittest .TestCase
44
55properties (TestParameter )
6- p = init_root()
7- rn = init_root_name()
8- rd = init_root_dir()
6+ p
7+ rn
8+ rd
99end
1010
1111
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 % class
35-
36-
37- function p = init_root()
12+ methods (TestParameterDefinition , Static )
13+ function [p , rn , rd ] = init_root()
3814
3915p = {{" " , " " }, ...
4016{" a/b" , " " }, ...
@@ -51,12 +27,7 @@ function test_root_name(tc, rn)
5127p{8 }{2 } = " c:\" ;
5228end
5329
54- end
55-
56-
57- function rn = init_root_name()
58-
59- rn = init_root();
30+ rn = p ;
6031
6132rn{4 }{2 } = " " ;
6233rn{5 }{2 } = " " ;
@@ -67,12 +38,7 @@ function test_root_name(tc, rn)
6738rn{8 }{2 } = " c:" ;
6839end
6940
70- end
71-
72-
73- function rd = init_root_dir()
74-
75- rd = init_root();
41+ rd = p ;
7642
7743if ispc()
7844rd{6 }{2 } = " " ;
@@ -81,3 +47,30 @@ function test_root_name(tc, rn)
8147end
8248
8349end
50+
51+ end
52+
53+
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
73+
74+ end
75+
76+ end
0 commit comments