Newer
Older
classdef test_expcodes < SCDtest
properties
expcode_obj;
SCDexps;
expcode = {'1','1005','1007','1008','1010'}; % list of expcodes to test
shote = {'68915','68915','70127','68915','68915'}; % different shot per exp code
%expcode = {'1'}; % list of expcodes to test
%shote = {'68915'}; % different shot per exp code
methods(TestClassSetup,ParameterCombination='sequential')
function setup_environment(testCase)
testCase.addTeardown(@cd,pwd);
testCase.addTeardown(@path,path);
testCase.addTeardown(@() SCDclass_expcode.close_all(0))
% Clean data dictionaries
SCD.clean_dd;
basePath = fullfile(fileparts(mfilename('fullpath')),'..','..');
run(fullfile(basePath,'rtccode_paths'));
% get SCD experimental code object container
testCase.SCDexps = SCDconf_createexpcodes;
SCDconf_setConf('SIM'); % set ConfigurationSettings for Simulation
function setup_expcode(testCase,expcode,shote)
% get this expcode object from expcode object container
fprintf('\n=== Testing expcode %s ===\n',expcode);
testCase.expcode_obj = getbymaincode(testCase.SCDexps,str2double(expcode));
testCase.shot = str2double(shote);
function test_expcode_printinfo(testCase)
testCase.expcode_obj.printinfo
function test_expcode_init(testCase)
fprintf('\n=== Testing init for expcode %d: %s === \n',...
testCase.expcode_obj.maincode,...
testCase.expcode_obj.name);
testCase.expcode_obj.init; % initialize
function test_expcode_setup(testCase)
fprintf('\n=== Testing setup for expcode %d: %s === \n',...
testCase.expcode_obj.maincode,...
testCase.expcode_obj.name);
testCase.expcode_obj.setup; % run setup this exp code
function test_expcode_compile_nodes(testCase)
% compile each node separately first
if isempty(node)
fprintf('skipping compilation for node %d since not configured\n',inode)
elseif ~node.active
fprintf('skipping compilation for node %d since not active\n',inode)
else
fprintf('\n === Testing Simulink compilation for node %02d of expcode %d: %s === \n',...
inode,testCase.expcode_obj.maincode,testCase.expcode_obj.name);
testCase.expcode_obj.compile(inode); % compile single node
end
end
end
function test_actualize(testCase)
testCase.expcode_obj.actualize(testCase.shot);
end
function test_expcode_sim(testCase)
testCase.assumeFail('Skipping all simulations tests temporarily to save time')
fprintf('\n === Testing Simulink simulation of tcv.slx for expcode %d: === \n',testCase.expcode_obj.maincode)
testCase.expcode_obj.sim; % simulate whole tcv.slx with this expcode
function test_build(testCase)
testCase.assumeFail('Skipping all build tests temporarily')
testCase.expcode_obj.build;