diff --git a/matlab/tests/test_requestnames.m b/matlab/tests/test_requestnames.m index 01527a0707adf72f6beea5f1d56396a8d8d34a8c..63595919b38cbbbedf2ad19c8636348badc1df83 100644 --- a/matlab/tests/test_requestnames.m +++ b/matlab/tests/test_requestnames.m @@ -1,46 +1,48 @@ classdef (SharedTestFixtures={... check_mds,check_gdatpaths}) ... test_requestnames < matlab.unittest.TestCase - + properties (Abstract) Machine; end - + properties(TestParameter,Abstract) % parameters that will vary during tests shot; requests_fast; % placeholders requests_slow; end -end - -function test_gdat_call(testCase,shot,request) %#ok<DEFNU> -% actual function to test gdat call -testCase.assertTrue(isnumeric(str2double(shot))); -testCase.assertTrue(ischar(request)); - -% gdat call -gdat_call = sprintf(['gdat_' lower(testCase.Machine) '(%s,''%s'')'],shot,request); -do_gdat_call = 1; - -switch request - case 'eqdsk' - % avoid writing files in /tmp, may not be allowed - gdat_call = sprintf(['gdat_%s(%s,''%s'',''write'',0)'],lower(testCase.Machine),shot,request); - end - -% logging -fprintf('Testing gdat call: %s\n',gdat_call); - -if do_gdat_call - gdat_out = eval(gdat_call); %#ok<NASGU> -else - gdat_out = struct([]); -end - -% in some future: check for warnings -%gdat_out = verifyWarningFree(testCase,eval(gdat_call),... -% 'Warning issued from gdat call:\n %s\n',gdat_call); - -% (add optional sanity checks of gdat_out here) -end + + methods(Static) + function test_gdat_call(testCase,shot,request) + % actual function to test gdat call + testCase.assertTrue(isnumeric(str2double(shot))); + testCase.assertTrue(ischar(request)); + + % gdat call + gdat_call = sprintf(['gdat_' lower(testCase.Machine) '(%s,''%s'')'],shot,request); + do_gdat_call = 1; + + switch request + case 'eqdsk' + % avoid writing files in /tmp, may not be allowed + gdat_call = sprintf(['gdat_%s(%s,''%s'',''write'',0)'],lower(testCase.Machine),shot,request); + end + + % logging + fprintf('Testing gdat call: %s\n',gdat_call); + + if do_gdat_call + gdat_out = eval(gdat_call); %#ok<NASGU> + else + gdat_out = struct([]); + end + + % in some future: check for warnings + %gdat_out = verifyWarningFree(testCase,eval(gdat_call),... + % 'Warning issued from gdat call:\n %s\n',gdat_call); + + % (add optional sanity checks of gdat_out here) + end + end +end \ No newline at end of file diff --git a/matlab/tests/test_requestnames_aug.m b/matlab/tests/test_requestnames_aug.m index 7521b34b605033988ea1089e526161e15d24b5f5..d05879f2409eb975eca933824c01701014ae5050 100644 --- a/matlab/tests/test_requestnames_aug.m +++ b/matlab/tests/test_requestnames_aug.m @@ -14,13 +14,13 @@ classdef (TestTags={'aug'})test_requestnames_aug < test_requestnames methods(Test,TestTags = {'fast'}) function test_gdat_call_fast(testCase,shot,requests_fast) - test_gdat_call(testCase,shot,requests_fast); + testCase.test_gdat_call(testCase,shot,requests_fast); end end methods(Test,TestTags = {'slow'}) function test_gdat_call_slow(testCase,shot,requests_slow) - test_gdat_call(testCase,shot,requests_slow); + testCase.test_gdat_call(testCase,shot,requests_slow); end end end \ No newline at end of file diff --git a/matlab/tests/test_requestnames_tcv.m b/matlab/tests/test_requestnames_tcv.m index e625ba60b47cbe6567639027455b0df97246967f..f40ecbfa9348473a86ef5552e37e9ad0340510a7 100644 --- a/matlab/tests/test_requestnames_tcv.m +++ b/matlab/tests/test_requestnames_tcv.m @@ -14,13 +14,13 @@ classdef (TestTags={'tcv'})test_requestnames_tcv < test_requestnames methods(Test,TestTags = {'fast'}) function test_gdat_call_fast(testCase,shot,requests_fast) - test_gdat_call(testCase,shot,requests_fast); + testCase.test_gdat_call(testCase,shot,requests_fast); end end methods(Test,TestTags = {'slow'}) function test_gdat_call_slow(testCase,shot,requests_slow) - test_gdat_call(testCase,shot,requests_slow); + testCase.test_gdat_call(testCase,shot,requests_slow); end end