Skip to content

Commit 7c60a61

Browse files
committed
test: split into files
1 parent cabc0e2 commit 7c60a61

File tree

4 files changed

+73
-60
lines changed

4 files changed

+73
-60
lines changed

test/TestFilePure.m

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,8 @@
1616
{"a/b/c.txt", "c"}, {"a/b/c.txt.gz", "c.txt"}, ...
1717
{"a/b/.c", ".c"}}
1818

19-
p_join = {{"", "", ""}, ...
20-
{"a", "", "a"}, ...
21-
{"", "a", "a"}, ...
22-
{"a/b/", "c/", "a/b/c"}, ...
23-
{"/", "", "/"}, ...
24-
{"", "/", "/"}, ...
25-
{"a", "b//", "a/b"}, ...
26-
{"a//", "b//", "a/b"}, ...
27-
{"a/b/../", "c/d/../", "a/b/../c/d/.."}, ...
28-
{"a/b", "..", "a/b/.."}, ...
29-
{"a/b", "c/d", "a/b/c/d"}, ...
30-
{"ab/cd", "/ef", "/ef"}, ...
31-
{stdlib.homedir(), "", stdlib.homedir()}, ...
32-
{matlabroot, "bin", stdlib.posix(matlabroot + "/bin")}
33-
}
34-
3519
p_suffix = {{"", ""}, {"/a/b/c", ""}, {"/a/b/c/", ""}, {"a/b/c.txt", ".txt"}, {"a/b/c.txt.gz", ".gz"}, {".stat", ".stat"}, {".stat.txt", ".txt"}}
3620

37-
p_with_suffix = {{"foo.h5", ".nc", "foo.nc"}, {"c", "", "c"}, {"c.nc", "", "c"}, ...
38-
{"", ".nc", ".nc"}, {"a//b///c///", ".h5", "a/b/c/.h5"}, ...
39-
{"a/b/.h5", ".nc", "a/b/.h5.nc"}, {"a/b", ".nc", "a/b.nc"}};
40-
41-
p_norm = {
42-
{"", "."}, ...
43-
{"a/..", "."}, ...
44-
{"//a/b/", "/a/b"}, ...
45-
{"/a/b/", "/a/b"}, ...
46-
{"a/b/", "a/b"}, ...
47-
{"a/../c", "c"}, ...
48-
{"a/b/../c", "a/c"}, ...
49-
{"a/b/../../c", "c"}, ...
50-
{"a/b/../../c/..", "."}, ...
51-
{"a/b/../../c/../..", ".."}, ...
52-
{"a////b", "a/b"}, ...
53-
{".a", ".a"}, ...
54-
{"..a", "..a"}, ...
55-
{"a.", "a."}, ...
56-
{"a..", "a.."}, ...
57-
{"./a/.", "a"}, ...
58-
{"../a", "../a"}
59-
};
60-
6121
p_root
6222
p_root_name
6323
end
@@ -112,11 +72,6 @@ function test_posix(tc)
11272
end
11373
end
11474

115-
116-
function test_join(tc, p_join)
117-
tc.verifyEqual(stdlib.join(p_join{1}, p_join{2}), p_join{3})
118-
end
119-
12075
function test_filename(tc, p_filename)
12176
tc.verifyEqual(stdlib.filename(p_filename{1}), p_filename{2})
12277
end
@@ -130,29 +85,14 @@ function test_stem(tc, p_stem)
13085
tc.verifyEqual(stdlib.stem(p_stem{1}), p_stem{2})
13186
end
13287

133-
13488
function test_is_absolute(tc, p_is_absolute)
13589
ok = stdlib.is_absolute(p_is_absolute{1}, stdlib.has_java());
13690
tc.verifyEqual(ok, p_is_absolute{2}, p_is_absolute{1})
13791
end
13892

139-
140-
function test_normalize(tc, p_norm)
141-
142-
tc.verifyEqual(stdlib.normalize(p_norm{1}), p_norm{2})
143-
144-
end
145-
146-
14793
function test_root(tc, p_root)
14894
tc.verifyEqual(stdlib.root(p_root{1}), p_root{2})
14995
end
15096

151-
152-
function test_with_suffix(tc, p_with_suffix)
153-
tc.verifyEqual(stdlib.with_suffix(p_with_suffix{1}, p_with_suffix{2}), p_with_suffix{3})
154-
end
155-
156-
15797
end
15898
end

test/TestJoin.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
classdef TestJoin < matlab.unittest.TestCase
2+
3+
properties (TestParameter)
4+
p = {{"", "", ""}, ...
5+
{"a", "", "a"}, ...
6+
{"", "a", "a"}, ...
7+
{"a/b/", "c/", "a/b/c"}, ...
8+
{"/", "", "/"}, ...
9+
{"", "/", "/"}, ...
10+
{"a", "b//", "a/b"}, ...
11+
{"a//", "b//", "a/b"}, ...
12+
{"a/b/../", "c/d/../", "a/b/../c/d/.."}, ...
13+
{"a/b", "..", "a/b/.."}, ...
14+
{"a/b", "c/d", "a/b/c/d"}, ...
15+
{"ab/cd", "/ef", "/ef"}, ...
16+
{stdlib.homedir(), "", stdlib.homedir()}, ...
17+
{matlabroot, "bin", stdlib.posix(matlabroot + "/bin")}
18+
}
19+
end
20+
21+
methods (Test)
22+
function test_join(tc, p)
23+
tc.verifyEqual(stdlib.join(p{1}, p{2}), p{3})
24+
end
25+
end
26+
27+
end

test/TestNormalize.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
classdef TestNormalize < matlab.unittest.TestCase
2+
3+
properties (TestParameter)
4+
p = {
5+
{"", "."}, ...
6+
{"a/..", "."}, ...
7+
{"//a/b/", "/a/b"}, ...
8+
{"/a/b/", "/a/b"}, ...
9+
{"a/b/", "a/b"}, ...
10+
{"a/../c", "c"}, ...
11+
{"a/b/../c", "a/c"}, ...
12+
{"a/b/../../c", "c"}, ...
13+
{"a/b/../../c/..", "."}, ...
14+
{"a/b/../../c/../..", ".."}, ...
15+
{"a////b", "a/b"}, ...
16+
{".a", ".a"}, ...
17+
{"..a", "..a"}, ...
18+
{"a.", "a."}, ...
19+
{"a..", "a.."}, ...
20+
{"./a/.", "a"}, ...
21+
{"../a", "../a"}
22+
};
23+
end
24+
25+
methods (Test)
26+
function test_normalize(tc, p)
27+
tc.verifyEqual(stdlib.normalize(p{1}), p{2})
28+
end
29+
end
30+
31+
end

test/TestWithSuffix.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
classdef TestWithSuffix < matlab.unittest.TestCase
2+
3+
properties (TestParameter)
4+
p = {{"foo.h5", ".nc", "foo.nc"}, {"c", "", "c"}, {"c.nc", "", "c"}, ...
5+
{"", ".nc", ".nc"}, {"a//b///c///", ".h5", "a/b/c/.h5"}, ...
6+
{"a/b/.h5", ".nc", "a/b/.h5.nc"}, {"a/b", ".nc", "a/b.nc"}};
7+
end
8+
9+
methods (Test)
10+
function test_with_suffix(tc, p)
11+
tc.verifyEqual(stdlib.with_suffix(p{1}, p{2}), p{3})
12+
end
13+
end
14+
15+
end

0 commit comments

Comments
 (0)