From 2dbe767b15de5ccb89e2c373da5675f50beeac56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= <stephane.adjemian@univ-lemans.fr> Date: Tue, 17 Nov 2015 18:45:26 +0100 Subject: [PATCH] Display approximated unit test coverage. --- src/run_unitary_tests.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/run_unitary_tests.m b/src/run_unitary_tests.m index 2a48fb3..1dfa61a 100644 --- a/src/run_unitary_tests.m +++ b/src/run_unitary_tests.m @@ -32,10 +32,13 @@ function [report, time] = run_unitary_tests(listoffiles) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. report = {}; - + +testcoverage = zeros(2,1); + for f=1:length(listoffiles) if isempty(strfind(listoffiles{f},'.#')) if is_unitary_test_available(listoffiles{f}) + testcoverage(1) = testcoverage(1) + 1; [check, info] = mtest(listoffiles{f}); if check disp(['***** Unitary tests in ' listoffiles{f} ' PASSED!'] ) @@ -44,11 +47,16 @@ for f=1:length(listoffiles) end report = [report; info]; else - disp(['Booh! No unitary tests available in ' listoffiles{f}]) + testcoverage(2) = testcoverage(2) + 1; end end end +atc = 100*testcoverage(1)/sum(testcoverage); + +skipline(2) +disp(sprintf('Approximated test coverage is %s%%',num2str(atc))) + if nargout>1 time = clock; end -- GitLab