88fun = {@stdlib.isoctave, @stdlib.has_dotnet, ...
99 @stdlib.has_java , @stdlib.has_python }
1010cpu_arch_fun = {@stdlib.cpu_arch, @stdlib.dotnet.cpu_arch, @stdlib.java.cpu_arch}
11- host_fun = {@stdlib.hostname, @stdlib.sys.get_hostname, @stdlib.dotnet.get_hostname, @stdlib.java.get_hostname, @stdlib.python.get_hostname}
1211user_fun = {@stdlib.get_username, @stdlib.sys.get_username, @stdlib.dotnet.get_username, @stdlib.java.get_username, @stdlib.python.get_username}
1312ia_fun = {' sys' , ' dotnet' , ' java' , ' python' }
14- ram_free_method = {' sys' , ' java' , ' python' }
15- ram_total_method = {' sys' , ' dotnet' , ' java' , ' python' }
16- cpu_load_method = {" java" , " python" , " sys" }
13+ cr_method = {' sys' , ' java' , ' python' }
1714end
1815
1916methods (TestClassSetup )
@@ -58,12 +55,12 @@ function test_get_pid(tc)
5855end
5956
6057
61- function test_cpu_load(tc , cpu_load_method )
62- n = " stdlib." + cpu_load_method + " .cpu_load" ;
58+ function test_cpu_load(tc , cr_method )
59+ n = " stdlib." + cr_method + " .cpu_load" ;
6360h = @stdlib .cpu_load ;
6461tc .assertNotEmpty(which(n ))
6562try
66- r = h(cpu_load_method );
63+ r = h(cr_method );
6764 tc .verifyGreaterThanOrEqual(r , 0 .)
6865catch e
6966 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
@@ -134,10 +131,13 @@ function test_is_parallel(tc)
134131tc .verifyClass(ip , ' logical' )
135132end
136133
137- function test_hostname(tc , host_fun )
138- is_capable(tc , host_fun )
139- h = host_fun();
140- tc .verifyGreaterThan(strlength(h ), 0 )
134+ function test_hostname(tc , ia_fun )
135+ try
136+ h = stdlib .hostname(ia_fun );
137+ tc .verifyGreaterThan(strlength(h ), 0 )
138+ catch e
139+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
140+ end
141141end
142142
143143function test_username(tc , user_fun )
@@ -163,9 +163,9 @@ function test_cpu_arch(tc, cpu_arch_fun)
163163tc .verifyGreaterThan(strlength(arch ), 0 , " CPU architecture should not be empty" )
164164end
165165
166- function test_ram_total(tc , ram_total_method )
166+ function test_ram_total(tc , ia_fun )
167167try
168- t = stdlib .ram_total(ram_total_method );
168+ t = stdlib .ram_total(ia_fun );
169169catch e
170170 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
171171 return
@@ -176,10 +176,10 @@ function test_ram_total(tc, ram_total_method)
176176end
177177
178178
179- function test_ram_free(tc , ram_free_method )
179+ function test_ram_free(tc , cr_method )
180180% don't verify less than or equal total due to shaky system measurements'
181181try
182- f = stdlib .ram_free(ram_free_method );
182+ f = stdlib .ram_free(cr_method );
183183catch e
184184 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
185185 return
0 commit comments