Something went wrong on our end
-
Federico Felici authoredFederico Felici authored
test_expcodes.m 2.43 KiB
classdef test_expcodes < matlab.unittest.TestCase
properties
expcode_obj;
SCDexps;
end
properties(MethodSetupParameter)
expcode_number = {'1','1005','1006','1010'}; % list of expcodes to test
end
methods(TestClassSetup)
function setup_environment(testCase)
testCase.addTeardown(@cd,pwd);
testCase.addTeardown(@path,path);
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
end
methods(TestMethodSetup)
function setup_expcode(testCase,expcode_number)
% get this expcode object from expcode object container
fprintf('\n=== Testing expcode %s ===\n',expcode_number);
testCase.expcode_obj = getbymaincode(testCase.SCDexps,str2double(expcode_number));
end
function test_expcode_setup(testCase)
fprintf('\n=== Testing callinits for expcode %d: %s === \n',...
testCase.expcode_obj.maincode,testCase.expcode_obj.name);
testCase.expcode_obj.callinits;
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
end
methods(Test)
function test_expcode(testCase)
fprintf('\n === Testing Simulink compilation for expcode %d: %s === \n',...
testCase.expcode_obj.maincode,testCase.expcode_obj.name);
% attempt compiling tcv.slx for this expcode
testCase.expcode_obj.compile; % compile tcv.slx with this expcode
end
function test_gencode(testCase)
switch testCase.expcode_obj.maincode
case 1010
SCDconf_setCODEconf('configurationSettingsCODEicc')
rtwbuild('SCD_rtccode_02_02');
rtwbuild('SCD_rtccode_02_03');
otherwise
% do nothing
end
end
function test_compilation(testCase)
expcode_ignore_compile = 1006;
testCase.assumeTrue(~any(testCase.expcode_obj.maincode == expcode_ignore_compile))
node_to_compile = 'SCD_rtccode_02_02';
node_to_compile = 'SCD_rtccode_02_03';
load_system(node_to_compile);
SCDconf_setCODEconf;
rtwbuild(node_to_compile);
end
end
end