11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}, ...
2- TestTags = {' R2021a ' , ' impure' }) ...
2+ TestTags = {' R2019b ' , ' impure' }) ...
33 TestDisk < matlab .unittest .TestCase
44
55properties
99properties (TestParameter )
1010Ps = {" ." , " " , " /" , getenv(" SystemDrive" ), " not-exist" }
1111Po = {mfilename(" fullpath" ) + " .m" , pwd(), " ." , " " , " not-exist" }
12- B_disk
13- B_is_removable
14- B_is_mount
15- B_hard_link_count
16- B_filesystem_type
17- B_owner
18- B_device
19- B_is_dev_drive
20- end
21-
22- methods (TestParameterDefinition , Static )
23- function [B_disk , B_is_removable , B_is_mount , B_hard_link_count , B_device , B_filesystem_type , B_owner , B_is_dev_drive ] = setupBackends()
24- B_disk = init_backend(" disk_available" );
25- B_is_removable = init_backend(" is_removable" );
26- B_is_mount = init_backend(" is_mount" );
27- B_hard_link_count = init_backend(" hard_link_count" );
28- B_device = init_backend(' device' );
29- B_filesystem_type = init_backend(" filesystem_type" );
30- B_owner = init_backend(" get_owner" );
31- B_is_dev_drive = init_backend(' is_dev_drive' );
32- end
12+ B_ps = {' python' , ' sys' }
13+ B_jps = {' java' , ' python' , ' sys' }
14+ B_jdps = {' java' , ' dotnet' , ' python' , ' sys' }
3315end
3416
3517methods (TestClassSetup )
@@ -40,9 +22,9 @@ function test_dirs(tc)
4022
4123methods (Test )
4224
43- function test_disk_available(tc , Ps , B_disk )
44- [r , b ] = stdlib .disk_available(Ps , B_disk );
45- tc .assertEqual(char(b ), B_disk )
25+ function test_disk_available(tc , Ps , B_jdps )
26+ [r , b ] = stdlib .disk_available(Ps , B_jdps );
27+ tc .assertEqual(char(b ), B_jdps )
4628
4729tc .verifyClass(r , ' uint64' )
4830
@@ -54,9 +36,9 @@ function test_disk_available(tc, Ps, B_disk)
5436end
5537
5638
57- function test_disk_capacity(tc , Ps , B_disk )
58- [r , b ] = stdlib .disk_capacity(Ps , B_disk );
59- tc .assertEqual(char(b ), B_disk )
39+ function test_disk_capacity(tc , Ps , B_jdps )
40+ [r , b ] = stdlib .disk_capacity(Ps , B_jdps );
41+ tc .assertEqual(char(b ), B_jdps )
6042
6143tc .verifyClass(r , ' uint64' )
6244
@@ -68,46 +50,49 @@ function test_disk_capacity(tc, Ps, B_disk)
6850end
6951
7052
71- function test_is_removable(tc , B_is_removable )
72- [y , b ] = stdlib .is_removable(pwd(), B_is_removable );
73- tc .assertEqual(char(b ), B_is_removable )
53+ function test_is_removable(tc , B_ps )
54+ [y , b ] = stdlib .is_removable(pwd(), B_ps );
55+ tc .assertEqual(char(b ), B_ps )
7456tc .verifyClass(y , ' logical' )
7557end
7658
77-
78- function test_is_mount(tc , B_is_mount )
79- y = stdlib .is_mount(pwd(), B_is_mount );
59+ function test_is_mount(tc , B_ps )
60+ y = stdlib .is_mount(pwd(), B_ps );
8061
8162tc .verifyClass(y , ' logical' )
82- tc .verifyTrue(stdlib .is_mount(" /" , B_is_mount ))
83- tc .verifyEmpty(stdlib .is_mount(tempname(), B_is_mount ))
63+ tc .verifyTrue(stdlib .is_mount(" /" , B_ps ))
64+ tc .verifyEmpty(stdlib .is_mount(tempname(), B_ps ))
8465
8566if ispc()
8667 sd = getenv(" SystemDrive" );
8768 tc .assertTrue(sd == stdlib .root_name(sd ), sd )
88- tc .verifyFalse(stdlib .is_mount(sd , B_is_mount ), sd )
89- tc .verifyTrue(stdlib .is_mount(sd + " /" , B_is_mount ), sd )
90- tc .verifyTrue(stdlib .is_mount(sd + " \" , B_is_mount ), sd )
69+ tc .verifyFalse(stdlib .is_mount(sd , B_ps ), sd )
70+ tc .verifyTrue(stdlib .is_mount(sd + " /" , B_ps ), sd )
71+ tc .verifyTrue(stdlib .is_mount(sd + " \" , B_ps ), sd )
9172end
9273end
9374
9475
95- function test_hard_link_count(tc , B_hard_link_count )
76+ function test_hard_link_count(tc , B_jps )
9677P = mfilename(" fullpath" ) + " .m" ;
9778
98- [i , b ] = stdlib .hard_link_count(P , B_hard_link_count );
99- tc .assertEqual(char(b ), B_hard_link_count )
79+ [i , b ] = stdlib .hard_link_count(P , B_jps );
80+ tc .assertEqual(char(b ), B_jps )
10081
101- tc .verifyGreaterThanOrEqual(i , 1 )
82+ if ismember(B_jps , stdlib .Backend().select(' hard_link_count' ))
83+ tc .verifyGreaterThanOrEqual(i , 1 )
84+ else
85+ tc .assertEmpty(i )
86+ end
10287
10388i = stdlib .hard_link_count(' ' );
10489tc .verifyEmpty(i )
10590end
10691
10792
108- function test_filesystem_type(tc , Ps , B_filesystem_type )
109- [t , b ] = stdlib .filesystem_type(Ps , B_filesystem_type );
110- tc .assertEqual(char(b ), B_filesystem_type )
93+ function test_filesystem_type(tc , Ps , B_jdps )
94+ [t , b ] = stdlib .filesystem_type(Ps , B_jdps );
95+ tc .assertEqual(char(b ), B_jdps )
11196tc .verifyClass(t , ' char' )
11297
11398if ~stdlib .exists(Ps )
@@ -120,9 +105,9 @@ function test_filesystem_type(tc, Ps, B_filesystem_type)
120105end
121106
122107
123- function test_is_dev_drive(tc , B_is_dev_drive )
124- [r , b ] = stdlib .is_dev_drive(pwd(), B_is_dev_drive );
125- tc .assertEqual(char(b ), B_is_dev_drive )
108+ function test_is_dev_drive(tc , B_ps )
109+ [r , b ] = stdlib .is_dev_drive(pwd(), B_ps );
110+ tc .assertEqual(char(b ), B_ps )
126111
127112tc .verifyClass(r , ' logical' )
128113end
@@ -141,38 +126,47 @@ function test_remove_file(tc)
141126end
142127
143128
144- function test_device(tc , Po , B_device )
145- [i , b ] = stdlib .device(Po , B_device );
129+ function test_device(tc , Po , B_jps )
130+ [i , b ] = stdlib .device(Po , B_jps );
146131tc .verifyClass(i , ' uint64' )
147- tc .assertEqual(char(b ), B_device )
148-
149- if ~stdlib .exists(Po )
150- tc .verifyEmpty(i )
132+ tc .assertEqual(char(b ), B_jps )
133+
134+ if ismember(B_jps , stdlib .Backend().select(' device' ))
135+ if ~stdlib .exists(Po )
136+ tc .verifyEmpty(i )
137+ else
138+ tc .assertNotEmpty(i )
139+ tc .assertGreaterThan(i , 0 )
140+ end
151141else
152- tc .assertNotEmpty(i )
153- tc .assertGreaterThan(i , 0 )
142+ tc .assertEmpty(i )
154143end
155144end
156145
157146
158- function test_inode(tc , Po , B_device )
147+ function test_inode(tc , Po , B_jps )
159148
160- [i , b ] = stdlib .inode(Po , B_device );
149+ [i , b ] = stdlib .inode(Po , B_jps );
161150tc .verifyClass(i , ' uint64' )
162- tc .assertEqual(char(b ), B_device )
163-
164- if ~stdlib .exists(Po )
165- tc .verifyEmpty(i )
151+ tc .assertEqual(char(b ), B_jps )
152+
153+ if ismember(B_jps , stdlib .Backend().select(' inode' ))
154+ if ~stdlib .exists(Po )
155+ tc .verifyEmpty(i )
156+ else
157+ tc .assertNotEmpty(i )
158+ tc .assertGreaterThan(i , 0 )
159+ end
166160else
167- tc .assertNotEmpty(i )
168- tc .assertGreaterThan(i , 0 )
161+ tc .assertEmpty(i )
169162end
163+
170164end
171165
172166
173- function test_owner(tc , Po , B_owner )
174- [o , b ] = stdlib .get_owner(Po , B_owner );
175- tc .assertEqual(char(b ), B_owner )
167+ function test_owner(tc , Po , B_jdps )
168+ [o , b ] = stdlib .get_owner(Po , B_jdps );
169+ tc .assertEqual(char(b ), B_jdps )
176170tc .verifyClass(o , ' char' )
177171
178172if ~stdlib .exists(Po )
0 commit comments