Skip to content

Commit d368bc8

Browse files
committed
Added script to test code examples
1 parent 9c37980 commit d368bc8

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Diff for: src/runtests_code_examples.m

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
% COPYRIGHT
2+
% This file is part of ORCA: https://github.com/ayrna/orca
3+
% Original authors: Pedro Antonio Gutiérrez, María Pérez Ortiz, Javier Sánchez Monedero
4+
% Citation: If you use this code, please cite the associated paper http://www.uco.es/grupos/ayrna/orreview
5+
% Copyright:
6+
% This software is released under the The GNU General Public License v3.0 licence
7+
% available at http://www.gnu.org/licenses/gpl-3.0.html
8+
% RUN SINGLE TESTS
9+
% This script runs single tests using the ORCA API. The toy dataset is used
10+
% with a 1 -hold-out experimental. Reference performance is compared. To
11+
% add an script just place it in the test/singletests folder following
12+
% other examples
13+
%
14+
clear;
15+
16+
tests_dir = ['code-examples'];
17+
eval(['cd ' tests_dir])
18+
files = dir('example*.m');
19+
20+
for i=1:length(files)
21+
% Clear (almost) all the variables to avoid issues with some mex files in Octave +4.2.2
22+
if (exist ('OCTAVE_VERSION', 'builtin') > 0)
23+
clear -x tests_dir files i
24+
else
25+
clearvars -except tests_dir files i
26+
end
27+
fprintf('==============================================\n');
28+
cmd = files(i).name;
29+
fprintf('Processing %s...\n', cmd);
30+
eval(cmd(1:end-2))
31+
end
32+
33+
% error is called in individual tests, so if code reach this point all the
34+
% tests have been run successfully
35+
fprintf('\nAll tests ended successfully\n')
36+
37+
rmpath Algorithms
38+
rmpath Measures
39+
rmpath Utils
40+
cd ..

0 commit comments

Comments
 (0)