diff --git a/unitTests/UnitTestConfig.m b/unitTests/UnitTestConfig.m index 0a2f0208c556b59c8ef65ae2c051dca85cc7fb15..b37ab83bd836c2b04f3859dfae9a285745f7491a 100644 --- a/unitTests/UnitTestConfig.m +++ b/unitTests/UnitTestConfig.m @@ -11,12 +11,10 @@ opt.testApogeeAnalysis = false; opt.testOptimization = false; opt.testSensitivity = false; - %% UNIT TEST TO CREATE % choose which folders to create data for -opt.saveTestSimulator = true; +opt.saveTestSimulator = {'multipleAB', 'ballistic', 'engineCut', 'solid', 'HRE'}; % Select the simulator tests to perform % opt.createTestCommonFunction = true; opt.saveTestApogeeAnalysis = false; opt.saveTestOptimization = false; opt.saveTestSensitivity = false; - diff --git a/unitTests/data/testSimulator/HRE/referenceState_HRE.mat b/unitTests/data/testSimulator/HRE/referenceState_HRE.mat index 481f58730389d2e27bfce06f78e32de9b0dfa010..d1f3b29a5f0f959734f5d9d953c13e627b2bb48f 100644 --- a/unitTests/data/testSimulator/HRE/referenceState_HRE.mat +++ b/unitTests/data/testSimulator/HRE/referenceState_HRE.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b93d349359893dc6b10a2959cb2b70f71ff1a4902280a50e795dde74db36285 -size 80208047 +oid sha256:8d44e6c60b057002f63ce0429a9c087f1bed08ab0aa14274f4dc2c1abf9700df +size 80254417 diff --git a/unitTests/data/testSimulator/ballistic/referenceState_ballistic.mat b/unitTests/data/testSimulator/ballistic/referenceState_ballistic.mat index 1327f8c0b7aab642d1960f88b495a1e2d60ee158..4b1b43c267e991d0f8bf85e762d91b49e3da6997 100644 --- a/unitTests/data/testSimulator/ballistic/referenceState_ballistic.mat +++ b/unitTests/data/testSimulator/ballistic/referenceState_ballistic.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db69488a839d1cbf7b6d1db8e05af0016098cc3910eb9c3fc95a076e126d48cd -size 80208047 +oid sha256:c28b587fa822511881f0cca4502b512f6616c89bcb4587a263d264a5324c41cf +size 80254417 diff --git a/unitTests/data/testSimulator/engineCut/referenceState_engineCut.mat b/unitTests/data/testSimulator/engineCut/referenceState_engineCut.mat index 0a01760d174b54177ea85a70d1a65f63f514f404..61ed552174b56278e79bf7ec0a923b5b6ecf32de 100644 --- a/unitTests/data/testSimulator/engineCut/referenceState_engineCut.mat +++ b/unitTests/data/testSimulator/engineCut/referenceState_engineCut.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47a3834687056548eff3dd4e27da6a749687a78d052b85a3a589d46876d0e8e8 -size 80208047 +oid sha256:b248789765f30a8a556cde4222e5fd529e799d8f5718ea68d58746b1f5343aaf +size 80254417 diff --git a/unitTests/data/testSimulator/multipleAB/referenceState_multipleAB.mat b/unitTests/data/testSimulator/multipleAB/referenceState_multipleAB.mat index 1cc02991c9c4d459bf9d236aab56ff47aca17f9e..026b1ae529cc4c4606b98f71101fb28e8097c52e 100644 --- a/unitTests/data/testSimulator/multipleAB/referenceState_multipleAB.mat +++ b/unitTests/data/testSimulator/multipleAB/referenceState_multipleAB.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dac6eb6f3c456a77a3e4241643983218cad47f1dee15fc17317514dfbd581a2f -size 80895844 +oid sha256:fbf1a2a08c2e412f580bb6080c03252451b950bcfdea85b10d8bc8b9b004167b +size 80909350 diff --git a/unitTests/data/testSimulator/solid/referenceState_solid.mat b/unitTests/data/testSimulator/solid/referenceState_solid.mat index e3e14a40a9140cffcb5297b218b66b729bb65652..3f6dc484b5901df714b6f59dec63e17566ce58f5 100644 --- a/unitTests/data/testSimulator/solid/referenceState_solid.mat +++ b/unitTests/data/testSimulator/solid/referenceState_solid.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d53b91bbb63edf70664108f16f383fd1f45289191bb675ac3713089da1a68b4e -size 80208047 +oid sha256:3e87e622e0ac53cb9739316eaa723168f7a3496496b41e70989e80593d2d79b4 +size 80254417 diff --git a/unitTests/saveTests.m b/unitTests/saveTests.m index fd096d825b364cf50b4108a75fe50c81b5eab822..763640b3590a443b5230c86cd795bee646e9966c 100644 --- a/unitTests/saveTests.m +++ b/unitTests/saveTests.m @@ -21,10 +21,9 @@ if isempty(rocket), rocket = Rocket(mission); end if isempty(environment), environment = Environment(mission, rocket.motor); end if isempty(wind), wind = Wind(mission); end if isempty(settings) - simPath = fullfile(fileparts(mfilename('fullpath')),'..', 'simulator', 'simulatorConfig.m'); - %odePath = fullfile(fileparts(mfilename('fullpath')), '..', '..', 'common', 'settings ', 'odeConfig.m'); - settings = Settings(simPath, 'ode','unitTest'); - + simPath = fullfile(fileparts(mfilename('fullpath')),'..', 'simulator', 'simulatorConfig.m'); + %odePath = fullfile(fileparts(mfilename('fullpath')), '..', '..', 'common', 'settings ', 'odeConfig.m'); + settings = Settings(simPath, 'ode','unitTest'); end Settings.read(settings, options, 'opt'); @@ -32,14 +31,12 @@ Settings.read(settings, options, 'opt'); %% CREATING SIMULATOR TESTS -if settings.opt.saveTestSimulator - verifiable = {'multipleAB', 'ballistic', 'engineCut', 'solid', 'HRE'}; - for k = 1:length(verifiable) - TestSimulator.saveTest(verifiable{k}, mission,rocket, wind, environment, settings ); +if ~isempty(settings.opt.saveTestSimulator) + for k = 1:length(settings.opt.saveTestSimulator) + TestSimulator.saveTest(settings.opt.saveTestSimulator{k}, mission, rocket, wind, environment, settings ); end end - % %% TEST COMMONFUNCTIONS % if opt.createTestCommonFunction % vars.mach = 0.05:0.05:1; diff --git a/unitTests/tests/TestSimulator.m b/unitTests/tests/TestSimulator.m index c6fde68913415131d616cff173b80b7160482eb8..061a3b4c04e4f4b5ab6e687c1121d1f3764a15e1 100644 --- a/unitTests/tests/TestSimulator.m +++ b/unitTests/tests/TestSimulator.m @@ -1,7 +1,5 @@ classdef TestSimulator < UnitTest - % TEST FUNZIONANTE, DA RISOLVERE PATH PER simulatorConfig.m in saveTest - properties settings refSimulator @@ -11,10 +9,7 @@ classdef TestSimulator < UnitTest verifiable = {'multipleAB', 'ballistic', 'engineCut', 'solid', 'HRE'}; end - % properties (TestParameter) - % verifiable = {'multipleAB', 'ballistic', 'engineCut', 'solid', 'HRE'}; - % end - + methods (TestMethodSetup) function setup(testCase, verifiable) currentPath = fileparts(mfilename('fullpath')); @@ -45,18 +40,13 @@ classdef TestSimulator < UnitTest end methods (Test) - function mainSimulatorTest(testCase, verifiable) - - % testCase.createTest(verifiable); - + function mainSimulatorTest(testCase) mainSimPath = fullfile('..', '..', 'simulator'); addpath(genpath(mainSimPath)); % Run main simulator [postp.stateA, postp.stateF] = mainSimulator(testCase.rocket, testCase.wind, testCase.environment, testCase.settings); - max(abs(postp.stateA.state.Y(3,:))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % Verify results testCase.verifyEqual(postp, testCase.refSimulator); end @@ -68,15 +58,12 @@ classdef TestSimulator < UnitTest currentPath = fileparts(mfilename('fullpath')); addpath(genpath(currentPath)); - disp('Started saving simulator tests') - if strcmp(verifiable, 'ballistic') settings.simulator.ballistic = 1; settings.simulator.parafoil = 0; end - if verifiable == "multipleAB" rocket.airbrakes.enabled = 1; @@ -87,7 +74,7 @@ classdef TestSimulator < UnitTest % end % simulator - [stateA, stateF, settings] = mainSimulator(rocket, wind, environment, settings,'unitTest',true); + [stateA, stateF, settings] = mainSimulator(rocket, wind, environment, settings, 'unitTest', true); % Save final state fileName = sprintf("referenceState_%s.mat", verifiable);