1- % Script to run all tests from the "xUintTests" directory.
2-
3- clear
4- clc
1+ function testRes = runAllTests()
2+ % RUNALLTESTS Run all tests from the "xUintTests" directory.
3+ % TESTRES = RUNALLTESTS() runs all tests from the "xUnitTests" directory
4+ % and returns the results TESTRES.
5+ %
6+
7+ % Get the root folder of the project - this should also work when the
8+ % project is referenced in another project.
9+ path2RootFolder = mfilename(' fullpath' );
10+ path2RootFolder = path2RootFolder(1 : end - numel(mfilename()));
511
612% Add current folder to path - this is needed for pre R2019a releases that
713% don't support Matlab Projects
8- addpath(pwd )
14+ addpath(path2RootFolder )
915
1016% Create and run the test suite
1117testSuite = matlab .unittest .TestSuite .fromFolder(...
12- ' xUnitTests' , ...
18+ [ path2RootFolder ' xUnitTests' ] , ...
1319 ' IncludingSubfolders' ,true );
20+
21+ str = ' Running "Path2D" tests ... ' ;
22+ printTopRule(' =' , numel(str ))
23+ fprintf(' <strong>%s </strong>\n ' , str );
24+ printTopRule(' =' , numel(str ))
25+
1426testRes = run(testSuite );
15- disp(testRes )
27+
28+ end % fcn
29+
30+
31+ function printTopRule(symbol , n )
32+ fprintf(' %s\n ' , repmat(symbol , 1 , n ));
33+ end % fcn
0 commit comments