diff --git a/tests/Makefile.am b/tests/Makefile.am index 3a10d09b8da64e00302c444f9f35ff4610ad9b4c..3086b5aa4da01a8cae6c26d1d92d2e0236c59497 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -237,12 +237,12 @@ dsge-var/dsgevar_forward_estimated_lambda.o.trs: dsge-var/simul_hybrid.o.trs # Matlab TRS Files M_TRS_FILES = $(patsubst %.mod, %.m.trs, $(MODFILES)) -M_TRS_FILES += run_block_byte_tests_matlab.m.trs run_reporting_test_matlab.m.trs +M_TRS_FILES += run_block_byte_tests_matlab.m.trs run_reporting_test_matlab.m.trs run_unitary_tests.m.trs M_XFAIL_TRS_FILES = $(patsubst %.mod, %.m.trs, $(XFAIL_MODFILES)) # Octave TRS Files O_TRS_FILES = $(patsubst %.mod, %.o.trs, $(MODFILES)) -O_TRS_FILES += run_block_byte_tests_octave.o.trs run_reporting_test_octave.o.trs +O_TRS_FILES += run_block_byte_tests_octave.o.trs run_reporting_test_octave.o.trs run_unitary_tests.o.trs O_XFAIL_TRS_FILES = $(patsubst %.mod, %.o.trs, $(XFAIL_MODFILES)) EXTRA_DIST = \ diff --git a/tests/run_unitary_tests.m b/tests/run_unitary_tests.m new file mode 100644 index 0000000000000000000000000000000000000000..e0101da5d31578affb8272b37cde4b8adcacf746 --- /dev/null +++ b/tests/run_unitary_tests.m @@ -0,0 +1,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