classdef test_expcodes < matlab.unittest.TestCase properties expcode_obj; SCDexps; shot; end properties(ClassSetupParameter) expcode = {'1','1005','1007','1008'}; % list of expcodes to test shote = {'68915','68915','70127','68915'}; % different shot per exp code end methods(TestClassSetup,ParameterCombination='sequential') function setup_environment(testCase) testCase.addTeardown(@cd,pwd); testCase.addTeardown(@path,path); testCase.addTeardown(@() SCDclass_expcode.close_all(0)) basePath = fullfile(fileparts(mfilename('fullpath')),'..'); run(fullfile(basePath,'rtccode_paths')); % get SCD experimental code object container testCase.SCDexps = SCDconf_createexpcodes; SCDconf_setSIMconf; % set ConfigurationSettings for Simulation end 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); end end methods(Test,TestTags={'expcodes'}) function test_expcode_printinfo(testCase) testCase.expcode_obj.printinfo end 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 end 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 end function test_expcode_compile_nodes(testCase) % compile each node separately first nodes = testCase.expcode_obj.getnodes; for inode = 1:numel(nodes) node = nodes(inode); if node.active 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 else fprintf('skipping compilation for node %d since not active\n',inode) 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 end function test_build(testCase) testCase.assumeFail('Skipping all build tests temporarily') testCase.expcode_obj.build; end end end