From a092f69a7818b111fd2fc2856484e253937178f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Thu, 19 Nov 2015 14:37:48 +0100
Subject: [PATCH] Added a script to run all the unit tests.

Install m-unit-tests module from Github/master if needed.
---
 tests/runalltests.m | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 tests/runalltests.m

diff --git a/tests/runalltests.m b/tests/runalltests.m
new file mode 100644
index 0000000..d597f17
--- /dev/null
+++ b/tests/runalltests.m
@@ -0,0 +1,39 @@
+opath = path();
+
+% Check that the m-unit-tests module is available.
+
+install_unit_test_toolbox = false;
+
+try
+    initialize_unit_tests_toolbox;
+catch
+    urlwrite('https://github.com/DynareTeam/m-unit-tests/archive/master.zip','master.zip');
+    warning('off','MATLAB:MKDIR:DirectoryExists')
+    mkdir('../externals')
+    warning('on','MATLAB:MKDIR:DirectoryExists')
+    unzip('master.zip','../externals')
+    delete('master.zip')
+    addpath([pwd() '/../externals/m-unit-tests-master/src'])
+    initialize_unit_tests_toolbox;
+    install_unit_test_toolbox = true;
+end
+
+% Initialize the dseries module
+try
+    initialize_dates_toolbox;
+catch
+    unit_tests_root = strrep(which('runalltests'),'runalltests.m','');
+    addpath([unit_tests_root '../src']);
+    initialize_dates_toolbox;
+end
+
+tmp = dates_src_root;
+tmp = tmp(1:end-1); % Remove trailing slash.
+run_unitary_tests_in_directory(tmp);
+
+delete('*.log');
+
+if install_unit_test_toolbox
+    rmdir('../externals/m-unit-tests-master','s');
+end
+path(opath);
\ No newline at end of file
-- 
GitLab