Skip to content
Snippets Groups Projects
test_requestnames.m 1.2 KiB
Newer Older
classdef (SharedTestFixtures={...
    check_mds,setup_gdatpaths}) ...
    test_requestnames < matlab.unittest.TestCase
  properties (Abstract)
    Machine;
  end
  
  properties(TestParameter,Abstract)
    % parameters that will vary during tests
    shot;
Federico Felici's avatar
Federico Felici committed
    requests_fast; % placeholders
    requests_slow;
  methods(Test,TestTags = {'fast'})
Federico Felici's avatar
Federico Felici committed
    function test_gdat_call_fast(testCase,shot,requests_fast)
      test_gdat_call(testCase,shot,requests_fast);
  methods(Test,TestTags = {'slow'})
Federico Felici's avatar
Federico Felici committed
    function test_gdat_call_slow(testCase,shot,requests_slow)
      test_gdat_call(testCase,shot,requests_slow);
    end
  end
  
end

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);

% logging
fprintf('Testing gdat call: %s\n',gdat_call);

gdat_out = eval(gdat_call); %#ok<NASGU>

% 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)