1
1
classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}, ...
2
- TestTags = {' R2021a ' , ' pure' }) ...
2
+ TestTags = {' R2019b ' , ' pure' }) ...
3
3
TestRoot < matlab .unittest .TestCase
4
4
5
5
properties (TestParameter )
6
- p
7
- rn
8
- rd
6
+ p = init_root()
7
+ rn = init_rn()
8
+ rd = init_rd()
9
9
end
10
10
11
11
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()
14
38
15
39
p = {{" " , " " }, ...
16
40
{" a/b" , " " }, ...
22
46
{' c:\etc' , " " }};
23
47
24
48
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:\" ;
28
52
end
29
53
30
- rn = p ;
54
+ end
31
55
32
- rn{4 }{2 } = " " ;
33
- rn{5 }{2 } = " " ;
34
56
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()
40
58
41
- rd = p ;
59
+ p = init_root();
60
+
61
+ p{4 }{2 } = " " ;
62
+ p{5 }{2 } = " " ;
42
63
43
64
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: " ;
47
68
end
48
69
49
70
end
50
71
51
- end
52
72
73
+ function p = init_rd()
53
74
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();
73
76
77
+ if ispc()
78
+ p{6 }{2 } = " " ;
79
+ p{7 }{2 } = " /" ;
80
+ p{8 }{2 } = " \" ;
74
81
end
75
82
76
- end
83
+ end
0 commit comments