2020-01-14 14:58:38 +01:00
|
|
|
% Copyright (C) 2013-2020 Dynare Team
|
2016-10-19 15:12:44 +02:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare 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 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
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2016-10-19 15:12:44 +02:00
|
|
|
|
2013-12-09 19:05:36 +01:00
|
|
|
top_test_dir = getenv('TOP_TEST_DIR');
|
|
|
|
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
2019-09-03 11:19:46 +02:00
|
|
|
dynare_config();
|
2013-12-09 19:05:36 +01:00
|
|
|
|
2016-10-24 12:56:26 +02:00
|
|
|
if isoctave
|
|
|
|
load_octave_packages
|
|
|
|
end
|
|
|
|
|
2013-12-09 19:05:36 +01:00
|
|
|
% Test Dynare Version
|
|
|
|
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
|
|
error('Incorrect version of Dynare is being tested')
|
|
|
|
end
|
|
|
|
|
|
|
|
mlist = get_directory_description('../matlab');
|
|
|
|
|
2019-02-18 17:33:52 +01:00
|
|
|
% Under Octave, do not run tests under matlab/missing/stats/
|
2020-01-14 14:58:38 +01:00
|
|
|
% Also skip load_m_data_file_legacy.m: it fails in the first test, but
|
|
|
|
% this is impossible to reproduce outside the runners.
|
2019-02-18 17:33:52 +01:00
|
|
|
if isoctave
|
|
|
|
mlist = mlist(find(~strncmp('../matlab/missing/stats/', mlist, 24)));
|
2020-01-14 14:58:38 +01:00
|
|
|
mlist = mlist(find(~strcmp('../matlab/load_m_file_data_legacy.m', mlist)));
|
2019-02-18 17:33:52 +01:00
|
|
|
end
|
|
|
|
|
2020-02-04 18:16:40 +01:00
|
|
|
% Set random seed, for reproducibility
|
2020-04-07 12:24:16 +02:00
|
|
|
if isoctave
|
2020-02-04 18:16:40 +01:00
|
|
|
randn('state',1);
|
|
|
|
rand('state',1);
|
|
|
|
else
|
|
|
|
rng(1);
|
|
|
|
end
|
|
|
|
|
2013-12-09 19:05:36 +01:00
|
|
|
failedtests = {};
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
|
|
|
|
|
for i = 1:length(mlist)
|
|
|
|
f = [top_test_dir filesep mlist{i} ];
|
|
|
|
if is_unitary_test_available(f)
|
|
|
|
[check, info] = mtest(f);
|
|
|
|
for j = 1:size(info, 1)
|
|
|
|
counter = counter + 1;
|
|
|
|
if ~info{j,3}
|
|
|
|
failedtests{length(failedtests)+1} = [ mlist{i} '#' num2str(info{j,2}) ];
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
cd(getenv('TOP_TEST_DIR'));
|
|
|
|
if isoctave
|
2013-12-16 10:25:39 +01:00
|
|
|
fid = fopen('run_all_unitary_tests.o.trs', 'w+');
|
2013-12-09 19:05:36 +01:00
|
|
|
else
|
2013-12-16 10:25:39 +01:00
|
|
|
fid = fopen('run_all_unitary_tests.m.trs', 'w+');
|
2013-12-09 19:05:36 +01:00
|
|
|
end
|
|
|
|
if length(failedtests) > 0
|
|
|
|
fprintf(fid,':test-result: FAIL\n');
|
|
|
|
fprintf(fid,':number-tests: %d\n', counter);
|
|
|
|
fprintf(fid,':number-failed-tests: %d\n', length(failedtests));
|
|
|
|
fprintf(fid,':list-of-failed-tests: %s\n', failedtests{:});
|
|
|
|
else
|
|
|
|
fprintf(fid,':test-result: PASS\n');
|
|
|
|
fprintf(fid,':number-tests: %d\n', counter);
|
|
|
|
fprintf(fid,':number-failed-tests: 0\n');
|
|
|
|
end
|
2017-03-17 22:49:01 +01:00
|
|
|
fprintf(fid,':elapsed-time: %f\n',0.0);
|
2013-12-09 19:05:36 +01:00
|
|
|
fclose(fid);
|
2016-10-19 15:11:30 +02:00
|
|
|
if ~isoctave
|
|
|
|
exit
|
2020-01-14 14:58:38 +01:00
|
|
|
end
|