Newer
Older
classdef (SharedTestFixtures={...
check_mds,setup_gdatpaths}) ...
test_requestnames < matlab.unittest.TestCase
properties(TestParameter,Abstract)
% parameters that will vary during tests
function test_gdat_call(testCase,machine,shot,request)
testCase.assertTrue(isnumeric(str2double(shot)));
testCase.assertTrue(ischar(request));
% gdat call
gdat_call = sprintf(['gdat_' lower(machine) '(%s,''%s'')'],shot,request);
% logging
testCase.log(sprintf('gdat_call: %s\n',gdat_call));
% in some future: check for warnings
%gdat_out = verifyWarningFree(testCase,eval(gdat_call),...
% 'Warning issued from gdat call:\n %s\n',gdat_call);
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
% add content checks of gdat_out here
end
end
end
% methods(TestClassSetup)
% function getShot(testCase,machine)
% switch machine
% case 'AUG'
% testCase.shot = 30594;
% case 'TCV'
% testCase.shot = 48836;
% end
% end
% end
%
% end
%
% if nverbose>=2 && nverbose ~= 11
% doplot = true;
% else
% doplot = false;
% end
%
% %% get request list
% if isempty(machine)
% [gd0,gp0] = gdat;
% else
% [gd0,gp0] = gdat('machine',machine);
% end
% if isempty(machine)
% machine = gp0.machine;
% end
% request_list = gd0.gdat_request;
%
% %% get default test shot for each machine
%
%
% %% possibly skip some since they take too long for a reduced test
% if iscell(testmode)
% skip = setdiff(request_list,testmode);
% testmode_not_in_list = setdiff(testmode,request_list);
% if ~isempty(testmode_not_in_list)
% if nverbose >= 1
% disp('***********************************************************************')
% warning(['following input requests nt in request_list: ' testmode_not_in_list{:}]);
% disp('***********************************************************************')
% end
% end
% else
% switch testmode
% case 'reduced'
% skip = skip_list(machine);
% case 'full'
% skip = ''; % skip none
% otherwise
% error('invalid testmode, should be ''reduced'' or ''full''');
% end
% end
%
% %% init
% Nreq = numel(gd0.gdat_request);
% err = zeros(Nreq,1);
% telaps = zeros(Nreq,1);
% skipped = false(Nreq,1);
% gdat_call = cell(Nreq,1);
%
% %% call gdat requests in a loop
% for ireq = 1:Nreq
% myrequest = request_list{ireq};
%
% if ~ismember(myrequest,skip)
% % build request string
% if strcmp(myrequest,'transp')
% shotfile_user='PUETTI';
% gdat_call{ireq} = sprintf(['gdat_' lower(machine) '(%d,''%s'',''doplot'',%d,''exp_name'',''%s'')'],shot,myrequest,doplot,shotfile_user);
% else
% gdat_call{ireq} = sprintf(['gdat_' lower(machine) '(%d,''%s'',''doplot'',%d)'],shot,myrequest,doplot);
% end
%
% % eval call
% [err(ireq),telaps(ireq),gdat_results{ireq}] = do_gdat_call(gdat_call{ireq},nverbose);
% skipped(ireq) = false;
% pause(0.1)
% else
% % skip
% err(ireq) = 0;
% telaps(ireq) = 0;
% skipped(ireq) = true;
% if nverbose>=11; fprintf('\n skipping gdat request ''%s''\n',myrequest); end
% end
% end
%
% pass = all(~err);
%
%
% function [machine,testmode,verbose] = parse_inputs(varargin)
% p = inputParser;
% p.addOptional('machine','');
% p.addOptional('testmode','reduced');
% p.addOptional('nverbose',1);
% p.parse(varargin{:});
%
% machine = p.Results.machine;
% testmode = p.Results.testmode;
% verbose = p.Results.nverbose;
%
% function skip = skip_list(machine)
% switch upper(machine)
% case 'AUG'
% skip = {'cxrs','transp','te_rho','ne_rho','nete_rho','ece_rho','eced_rho','cxrs_rho','eqdsk','equil'};
% otherwise
% warning('no list to skip defined for machine ''%s''',machine);
% skip = '';
% end
%
% function [err,telaps,gdat_result] = do_gdat_call(gdat_call,nverbose)
% if nverbose >= 11
% fprintf('\n calling %s...\n',gdat_call);
% end
%
% tic
% try
% [gdat_result,~,err] = eval(gdat_call);
% catch ME
% err = -1;
% gdat_result.data = [];
% getReport(ME); %,'extended');
% end
% telaps = toc; % elapsed time
% end