Skip to content

Commit

Permalink
Updated model to make sure signals visible. Uncommented code for test…
Browse files Browse the repository at this point in the history
…ing solutions after adding solutions scripts.
  • Loading branch information
callieEDU committed Nov 19, 2024
1 parent 94adcab commit a48c82f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 60 deletions.
Binary file modified Models/EVSystemConverterModel.slx
Binary file not shown.
120 changes: 60 additions & 60 deletions SoftwareTests/SolnSmokeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,66 +68,66 @@ function SetUpPath(testCase,Project)

end % methods (TestClassSetup)

% methods(Test)
%
% % Check that solutions files exist for each of the student
% % templates
% function ExistSolns(testCase,File)
% SolutionName = replace(string(File),".mlx","Soln.mlx");
% assert(exist(SolutionName,"file"),"Missing solutions for "+File);
% end
%
%
% function SmokeRun(testCase,File)
%
% % Navigate to project root folder:
% cd(testCase.RootFolder)
% FileToRun = replace(string(File),".mlx","Soln.mlx");
%
% % Pre-test:
% PreFiles = CheckPreFile(testCase,FileToRun);
% run(PreFiles);
%
% % Run SmokeTest
% disp(">> Running " + FileToRun);
% try
% run(fullfile("InstructorResources","Solutions",FileToRun));
% catch ME
%
% end
%
% % Post-test:
% PostFiles = CheckPostFile(testCase,FileToRun);
% run(PostFiles)
%
% % Log every figure created during run:
% Figures = findall(groot,'Type','figure');
% Figures = flipud(Figures);
% if ~isempty(Figures)
% for f = 1:size(Figures,1)
% if ~isempty(Figures(f).Number)
% FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
% log(testCase,1,FigDiag);
% end
% end
% end
%
% % Close all figures and Simulink models
% close all force
% if any(matlab.addons.installedAddons().Name == "Simulink")
% bdclose all
% end
%
% % Rethrow error if any
% if exist("ME","var")
% if ~any(strcmp(ME.identifier,KnownIssuesID))
% rethrow(ME)
% end
% end
%
% end
%
% end % Test Methods
methods(Test)

% Check that solutions files exist for each of the student
% templates
function ExistSolns(testCase,File)
SolutionName = replace(string(File),".mlx","Soln.mlx");
assert(exist(SolutionName,"file"),"Missing solutions for "+File);
end


function SmokeRun(testCase,File)

% Navigate to project root folder:
cd(testCase.RootFolder)
FileToRun = replace(string(File),".mlx","Soln.mlx");

% Pre-test:
PreFiles = CheckPreFile(testCase,FileToRun);
run(PreFiles);

% Run SmokeTest
disp(">> Running " + FileToRun);
try
run(fullfile("InstructorResources","Solutions",FileToRun));
catch ME

end

% Post-test:
PostFiles = CheckPostFile(testCase,FileToRun);
run(PostFiles)

% Log every figure created during run:
Figures = findall(groot,'Type','figure');
Figures = flipud(Figures);
if ~isempty(Figures)
for f = 1:size(Figures,1)
if ~isempty(Figures(f).Number)
FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
log(testCase,1,FigDiag);
end
end
end

% Close all figures and Simulink models
close all force
if any(matlab.addons.installedAddons().Name == "Simulink")
bdclose all
end

% Rethrow error if any
if exist("ME","var")
if ~any(strcmp(ME.identifier,KnownIssuesID))
rethrow(ME)
end
end

end

end % Test Methods

methods (Access = private)

Expand Down

0 comments on commit a48c82f

Please sign in to comment.