run_all_unitary_tests.m 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
top_test_dir = getenv('TOP_TEST_DIR');
addpath(top_test_dir);
addpath([top_test_dir filesep '..' filesep 'matlab']);
dynare_config([], 0);

% Test Dynare Version
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
    error('Incorrect version of Dynare is being tested')
end

mlist = get_directory_description('../matlab');

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
    fid = fopen('run_unitary_tests.o.trs', 'w+');
else
    fid = fopen('run_unitary_tests.m.trs', 'w+');
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
fclose(fid);
exit