runalltests.m 1.71 KB
Newer Older
1
function runalltests()
2

3
% Copyright (C) 2015-2018 Dynare Team
Stéphane Adjemian's avatar
Stéphane Adjemian committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare dseries submodule is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

18
19
20
dseries_src_root = []; % Initialize path as an array to be updated
                       % when calling initialize_dseries_toolbox() script.

21
22
opath = path();

23
system('rm -f failed');
24
system('rm -f pass');
25

26
27
28
29
% Check that the m-unit-tests module is available.
try
    initialize_unit_tests_toolbox;
catch
30
    error('Missing dependency: m-unit-tests module is not available.')
31
32
end

33
34
35
% Get path to the current script
unit_tests_root = strrep(which('runalltests'),'runalltests.m','');

36
37
% Initialize the dseries module
try
38
    initialize_dseries_toolbox();
39
catch
Stéphane Adjemian's avatar
Stéphane Adjemian committed
40
    addpath([unit_tests_root '../src']);
41
    initialize_dseries_toolbox();
42
43
end

44
45
warning off

Stéphane Adjemian's avatar
Stéphane Adjemian committed
46
if isoctave()
47
    if ~user_has_octave_forge_package('io')
48
        error('Missing dependency: io package is not available.')
49
    end
50
    more off;
51
    addpath([unit_tests_root 'fake']);
52
53
end

54
r = run_unitary_tests_in_directory(dseries_src_root(1:end-1));
55
56

delete('*.log');
57

58
if any(~[r{:,3}])
59
    system('touch failed');
60
61
else
    system('touch pass');
62
63
64
end

warning on
Stéphane Adjemian's avatar
Stéphane Adjemian committed
65
66
67
path(opath);

display_report(r);