@@ -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
0 commit comments