Skip to content

Commit f1c38d6

Browse files
committed
Local smoke tests a solution tests all pass. GitLab CI pass with warnings. Potentially an issue with the amount of data being printed exceeding the log file max size.
Added solutions and test files.
1 parent c242b92 commit f1c38d6

15 files changed

+74
-62
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

SoftwareTests/SolnSmokeTests.m

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -68,66 +68,66 @@ function SetUpPath(testCase,Project)
6868

6969
end % methods (TestClassSetup)
7070

71-
% methods(Test)
72-
%
73-
% % Check that solutions files exist for each of the student
74-
% % templates
75-
% function ExistSolns(testCase,File)
76-
% SolutionName = replace(string(File),".mlx","Soln.mlx");
77-
% assert(exist(SolutionName,"file"),"Missing solutions for "+File);
78-
% end
79-
%
80-
%
81-
% function SmokeRun(testCase,File)
82-
%
83-
% % Navigate to project root folder:
84-
% cd(testCase.RootFolder)
85-
% FileToRun = replace(string(File),".mlx","Soln.mlx");
86-
%
87-
% % Pre-test:
88-
% PreFiles = CheckPreFile(testCase,FileToRun);
89-
% run(PreFiles);
90-
%
91-
% % Run SmokeTest
92-
% disp(">> Running " + FileToRun);
93-
% try
94-
% run(fullfile("InstructorResources","Solutions",FileToRun));
95-
% catch ME
96-
%
97-
% end
98-
%
99-
% % Post-test:
100-
% PostFiles = CheckPostFile(testCase,FileToRun);
101-
% run(PostFiles)
102-
%
103-
% % Log every figure created during run:
104-
% Figures = findall(groot,'Type','figure');
105-
% Figures = flipud(Figures);
106-
% if ~isempty(Figures)
107-
% for f = 1:size(Figures,1)
108-
% if ~isempty(Figures(f).Number)
109-
% FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
110-
% log(testCase,1,FigDiag);
111-
% end
112-
% end
113-
% end
114-
%
115-
% % Close all figures and Simulink models
116-
% close all force
117-
% if any(matlab.addons.installedAddons().Name == "Simulink")
118-
% bdclose all
119-
% end
120-
%
121-
% % Rethrow error if any
122-
% if exist("ME","var")
123-
% if ~any(strcmp(ME.identifier,KnownIssuesID))
124-
% rethrow(ME)
125-
% end
126-
% end
127-
%
128-
% end
129-
%
130-
% end % Test Methods
71+
methods(Test)
72+
73+
% Check that solutions files exist for each of the student
74+
% templates
75+
function ExistSolns(testCase,File)
76+
SolutionName = replace(string(File),".mlx","Soln.mlx");
77+
assert(exist(SolutionName,"file"),"Missing solutions for "+File);
78+
end
79+
80+
81+
function SmokeRun(testCase,File)
82+
83+
% Navigate to project root folder:
84+
cd(testCase.RootFolder)
85+
FileToRun = replace(string(File),".mlx","Soln.mlx");
86+
87+
% Pre-test:
88+
PreFiles = CheckPreFile(testCase,FileToRun);
89+
run(PreFiles);
90+
91+
% Run SmokeTest
92+
disp(">> Running " + FileToRun);
93+
try
94+
run(fullfile("InstructorResources","Solutions",FileToRun));
95+
catch ME
96+
97+
end
98+
99+
% Post-test:
100+
PostFiles = CheckPostFile(testCase,FileToRun);
101+
run(PostFiles)
102+
103+
% Log every figure created during run:
104+
Figures = findall(groot,'Type','figure');
105+
Figures = flipud(Figures);
106+
if ~isempty(Figures)
107+
for f = 1:size(Figures,1)
108+
if ~isempty(Figures(f).Number)
109+
FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
110+
log(testCase,1,FigDiag);
111+
end
112+
end
113+
end
114+
115+
% Close all figures and Simulink models
116+
close all force
117+
if any(matlab.addons.installedAddons().Name == "Simulink")
118+
bdclose all
119+
end
120+
121+
% Rethrow error if any
122+
if exist("ME","var")
123+
if ~any(strcmp(ME.identifier,KnownIssuesID))
124+
rethrow(ME)
125+
end
126+
end
127+
128+
end
129+
130+
end % Test Methods
131131

132132
methods (Access = private)
133133

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info Ref="InstructorResources" Type="Relative"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="55a1fde4-9989-42e3-9473-8a804f6f9408" type="Reference"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info Ref="SoftwareTests/TestData" Type="Relative"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="81aae468-5481-45aa-a873-0ac476c213e6" type="Reference"/>

0 commit comments

Comments
 (0)