Skip to content

Commit e8729e1

Browse files
committed
add main function to run tests
1 parent dc875b4 commit e8729e1

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,52 @@ check_my_code_report.txt
1212

1313
# exclude content of files for virtual env (mostly for the doc)
1414
cpp_ptb
15+
env
1516

1617
# ignore file created by sphynx
1718
/docs/build
1819

20+
# exclude temp files from tests and coverage
21+
*test_code_report.txt
22+
test_report.log
23+
*coverage*
24+
1925
# exclude node js stuff
2026
node_modules/*
2127
package-lock.json
28+
29+
## MATLAB / OCTAVE gitignore template
30+
31+
# From : https://github.com/github/gitignore/blob/master/Global/MATLAB.gitignore
32+
33+
# Windows default autosave extension
34+
*.asv
35+
36+
# OSX / *nix default autosave extension
37+
*.m~
38+
39+
# Compiled MEX binaries (all platforms)
40+
*.mex*
41+
42+
# Packaged app and toolbox files
43+
*.mlappinstall
44+
*.mltbx
45+
46+
# Generated helpsearch folders
47+
helpsearch*/
48+
49+
# Simulink code generation folders
50+
slprj/
51+
sccprj/
52+
53+
# Matlab code generation folders
54+
codegen/
55+
56+
# Simulink autosave extension
57+
*.autosave
58+
59+
# Simulink cache files
60+
*.slxc
61+
62+
# Octave session info
63+
octave-workspace

runTests.m

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function runTests()
2+
%
3+
% (C) Copyright 2022 CPP_PTB developers
4+
5+
% Elapsed time is ??? seconds.
6+
7+
tic;
8+
9+
thisPath = fileparts(mfilename('fullpath'));
10+
11+
cd(thisPath);
12+
13+
fprintf('\nHome is %s\n', getenv('HOME'));
14+
15+
warning('OFF');
16+
17+
folderToCover = fullfile(thisPath, 'src');
18+
addpath(genpath(folderToCover));
19+
testFolder = fullfile(thisPath, 'tests');
20+
21+
success = moxunit_runtests( ...
22+
testFolder, ...
23+
'-verbose', '-recursive', '-with_coverage', ...
24+
'-cover', folderToCover, ...
25+
'-cover_xml_file', 'coverage.xml', ...
26+
'-cover_html_dir', fullfile(thisPath, 'coverage_html'));
27+
28+
if success
29+
system('echo 0 > test_report.log');
30+
else
31+
system('echo 1 > test_report.log');
32+
end
33+
34+
toc;
35+
36+
end

0 commit comments

Comments
 (0)