runalltests.m 1.66 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
24
system('rm -f failed');

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

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

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

43
44
warning off

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

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

delete('*.log');
56

57
if any(~[r{:,3}])
58
    system('touch failed');
59
60
61
end

warning on
Stéphane Adjemian's avatar
Stéphane Adjemian committed
62
63
64
65
path(opath);


display_report(r);