Skip to content

Commit 48a52bd

Browse files
committed
test more thorough
1 parent 54fdb90 commit 48a52bd

File tree

7 files changed

+43
-4
lines changed

7 files changed

+43
-4
lines changed

test/TestDisk.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
owner_fun = {@stdlib.get_owner, @stdlib.sys.get_owner, @stdlib.dotnet.get_owner, @stdlib.java.get_owner, @stdlib.python.get_owner}
1717
end
1818

19+
methods(TestClassSetup)
20+
function pkg_path(tc)
21+
p = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
22+
tc.applyFixture(p)
23+
end
24+
end
25+
1926
methods (Test)
2027

2128
function test_disk_available(tc, Ps, disk_available_fun)

test/TestFilename.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
properties (TestParameter)
44
p = init_p()
5-
e = {'/a/b/c/', "/a/b/c/"}
5+
e = {'/a/b/c/', "a/b/c/"}
6+
end
7+
8+
methods(TestClassSetup)
9+
function pkg_path(tc)
10+
msp = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
11+
tc.applyFixture(msp)
12+
end
613
end
714

815
methods (Test, TestTags="pure")
@@ -25,7 +32,7 @@ function test_filename_empty(tc, e)
2532
{"Hi", "Hi"}, ...
2633
{"/a/b/c", "c"}, ...
2734
{'a/b/c.txt', 'c.txt'}, ...
28-
{"a/b/c.txt.gz", "c.txt.gz"}, ...
35+
{"a///b//c.txt.gz", "c.txt.gz"}, ...
2936
{"a/b/.hello", ".hello"}
3037
};
3138

test/TestHDF4.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ function setup_file(tc)
1010
tc.file = fullfile(matlabroot, "toolbox/matlab/demos/example.hdf");
1111
tc.assumeThat(tc.file, IsFile)
1212
end
13+
14+
function pkg_path(tc)
15+
msp = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
16+
tc.applyFixture(msp)
17+
end
1318
end
1419

1520
methods (Test, TestTags="hdf4")

test/TestHDF5.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
methods(TestClassSetup)
2323

24+
function pkg_path(tc)
25+
msp = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
26+
tc.applyFixture(msp)
27+
end
28+
2429
function set_temp_wd(tc)
2530
if isMATLABReleaseOlderThan('R2022a')
2631
tc.td = tempname();

test/TestIsExe.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
p = {{fileparts(mfilename('fullpath')) + "/../Readme.md", false}, {"not-exist", false}}
55
end
66

7+
methods(TestClassSetup)
8+
function pkg_path(tc)
9+
msp = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
10+
tc.applyFixture(msp)
11+
end
12+
end
13+
714
methods(Test, TestTags="impure")
815

916
function test_is_exe(tc, p)

test/TestJava.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
classdef TestJava < matlab.unittest.TestCase
22

3+
methods(TestClassSetup)
4+
function pkg_path(tc)
5+
msp = matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))));
6+
tc.applyFixture(msp)
7+
end
8+
end
39

410
methods(Test, TestTags="java")
511

test/TestSys.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ function test_cpu_count(tc)
9595
end
9696

9797
function test_checkRAM(tc)
98-
tc.verifyClass(stdlib.checkRAM(1, "double"), "logical")
98+
tc.verifyTrue(stdlib.checkRAM(1, "double"))
9999
end
100100

101101
function test_is_parallel(tc)
102-
tc.verifyClass(stdlib.is_parallel_worker(), 'logical')
102+
ip = stdlib.is_parallel_worker();
103+
tc.verifyNotEmpty(ip)
104+
tc.verifyClass(ip, 'logical')
103105
end
104106

105107
function test_hostname(tc, host_fun)

0 commit comments

Comments
 (0)