Tutorial on formal tests for RAPTOR
A suite of tests for RAPTOR is provided to ensure that no modifications are committed that accidentally break the code.
The rules: * These tests must be run before each commit to the trunk. * Each SVN commit action into the trunk must pass all tests. * SVN commits into a branch are not required to pass the tests.
The tests are stored in the folder ./tests
Contents
pwdnow = pwd; ls ../tests/ close all hidden;
qlkANN_test.m RAPTOR_simulink_tests/ run_RAPTOR_matlab_tests.m RAPTOR_codegen_tests/ RAPTOR_simulink_tests.m run_RAPTOR_simulink_tests.m RAPTOR_codegen_tests.m README run_RAPTOR_tests.m RAPTOR_matlab_tests/ run_cmdline.m .svn/ RAPTOR_matlab_tests.m run_RAPTOR_codegen_tests.m
Matlab-only tests
Tests for the matlab version only are run by
run('../tests/run_RAPTOR_matlab_tests')
Running RAPTOR_matlab_tests .......... .......... ..... Done RAPTOR_matlab_tests __________
Simulink tests
Simulink tests are run by
run('../tests/run_RAPTOR_simulink_tests') % These may take some time to complete, since a .mex for the .slx model % must be built first.
Running simple Simulink RAPTOR tests This may take some time while model is compiled, be patient... Running RAPTOR_simulink_tests loading Simulink Configuration Settings from config_Default.m Initializing RAPTOR parameters Assigning Simulink.Parameters numerics_params chi_e_params neos_params hmode_params ntm_params saw_params echcd_params nbhcd_params prad_params palpha_params pbrem_params pei_params x0_params Done (Assigning Simulink.Parameters) Assigned signals to Sim_in=Simulink.SimulationData.Dataset Done (RAPTOR_predictive_sim_test_loadparams) . Done RAPTOR_simulink_tests __________
What to do if a test fails
If a test fails, the specific test can be re-run (to inspect the error thrown) by calling the test from the /tests dirctory and specifying the test name, e.g: results = run(RAPTOR_matlab_tests,'testname')
cd('../tests') testresults = run(RAPTOR_matlab_tests,'testChieBgB'); disp(testresults) cd(pwd)
Running RAPTOR_matlab_tests
.
Done RAPTOR_matlab_tests
__________
TestResult with properties:
Name: 'RAPTOR_matlab_tests/testChieBgB'
Passed: 1
Failed: 0
Incomplete: 0
Duration: 3.8080
Totals:
1 Passed, 0 Failed, 0 Incomplete.
3.808 seconds testing time.