Commit 85522bfa authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Fixed indentation.

parent c548b2a9
......@@ -2,13 +2,13 @@ function str = build_report_summary(reportfile, printonscreen, mailreport)
% Builds summary report for the unit tests.
%
% INPUTS
% INPUTS
% - reportfile [string] Name of the mat files where the unit tests results are stored.
% - printonscreen [logical] Report is displayed in the command window if true.
% - mailreport [string] Email adress where the report summary is to be sent.
%
% OUTPUTS
% - str [string] Report summary.
% OUTPUTS
% - str [string] Report summary.
% Copyright (C) 2013-2014 Dynare Team
%
......@@ -20,8 +20,8 @@ function str = build_report_summary(reportfile, printonscreen, mailreport)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
......@@ -94,9 +94,9 @@ if mailreport
if exist('~/.matlab-send-mail-info','file')
fid = fopen('~/.matlab-send-mail-info','r');
else
disp(['build_report_summary:: I Cannot send the report to ' mailto ' because the sender and the smtp server are not defined!'])
disp([' You probably need to add a ''.matlab-send-mail-info'' in your root directory...'])
return
disp(['build_report_summary:: I Cannot send the report to ' mailto ' because the sender and the smtp server are not defined!'])
disp([' You probably need to add a ''.matlab-send-mail-info'' in your root directory...'])
return
end
setpref('Internet','SMTP_Server',fgetl(fid));
setpref('Internet','SMTP_Username',fgetl(fid));
......@@ -107,5 +107,5 @@ if mailreport
for i=2:size(str,1)
STR = [STR 10 deblank(str(i,:)) ];
end
sendmail(mailto,'Dynare/Matlab unitary tests',STR);
sendmail(mailto,'Dynare/Matlab unitary tests',STR);
end
\ No newline at end of file
......@@ -12,8 +12,8 @@ function t = dassert(A,B,tol)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
......
......@@ -2,22 +2,22 @@ function dtest(fun, tpath)
% Runs unit test defined in fun, by calling mtest routine, and display results.
%
% INPUTS
% INPUTS
% - fun [string], name of the Matlab routine where unit tests have to be run (with path).
% - tpath [string], path to the folder where the test routines generated by mtest should be
% temporarly saved.
%
% OUTPUTS
% OUTPUTS
% None.
%
% REMARKS
% REMARKS
% - If only one input argument is provided, fname must be a string containing the
% full path to the targeted matlab routine.
% - If two input arguments are provided, fname is the base name of the targeted
% matlab routine and fpath is the path to this routine.
%
% See also mtest
% Copyright (C) 2011-2014 Dynare Team
%
% This file is part of Dynare (m-unit-tests module).
......@@ -28,8 +28,8 @@ function dtest(fun, tpath)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
......
......@@ -2,11 +2,11 @@ function flist = get_directory_description(basedir)
% Lists recursively all the *.m files in a directory.
%
% INPUTS
% INPUTS
% - basedir [string], the name of the directory to be inspected.
%
% OUTPUTS
% - flist [cell of strings], the files under basedir (and subfolders).
% OUTPUTS
% - flist [cell of strings], the files under basedir (and subfolders).
% Copyright (C) 2013-2014 Dynare Team
%
......@@ -18,18 +18,18 @@ function flist = get_directory_description(basedir)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~nargin || isempty(basedir)
% Current directory is the default value of basedir
basedir = '.';
% Current directory is the default value of basedir
basedir = '.';
end
dd = dir(basedir);
flist = {};
file = 1;
......@@ -46,6 +46,6 @@ for f=1:length(dd)
flist{length(flist)+1} = [basedir filesep dd(f).name];
end
end
file = file + 1;
file = file + 1;
end
end
\ No newline at end of file
% Get the path to the m-unit-tests/src folder.
unit_tests_src_root = strrep(which('initialize_unit_tests_toolbox'),'initialize_unit_tests_toolbox.m','');
if ~exist('isoctave','file')
if ~exist('isoctave','file')
addpath([unit_tests_src_root '/missing/isoctave'])
end
......
......@@ -3,10 +3,10 @@ function info = is_unitary_test_available(fun)
% Decides if unitary tests defined in a matlab routine (file) have to be run
% by checking the content of the first line.
%
% INPUTS
% INPUTS
% - fun [string], name of the routine (with full relative path)
%
% OUTPUTS
% OUTPUTS
% - info [integer], scalar equal to 1 if unitary tests must be run, 0 otherwise.
% Copyright (C) 2013-2014 Dynare Team
......@@ -19,13 +19,13 @@ function info = is_unitary_test_available(fun)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
info = 0;
fid = fopen(fun,'r');
......
function l = isoctave()
% Tests if Octave is used.
% Copyright (C) 2013-2014 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
......
function skipline(n, fid)
% This function prints n newlines to fid
%
% INPUTS
% INPUTS
%
% n [integer] Number of newlines to print
% fid [integer] file id returned by fopen
%
% OUTPUTS
%
% OUTPUTS
% None
%
......@@ -25,7 +25,7 @@ function skipline(n, fid)
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin < 2
fid = 1;
......
......@@ -2,11 +2,11 @@ function [check, info] = mtest(fname, fpath)
% Extracts unit test sections from matlab's routine, executes the tests and reports results.
%
% INPUTS
% INPUTS
% - fname [string], name of the Matlab routine where unit tests have to be run.
% * fpath [string], path to the routine
%
% OUTPUTS
% OUTPUTS
% - check [integer], scalar equal to 0 if the test fails and 0 otherwise
% - info [cell], a cell describing the test results. Cell info has nn rows and
% five columns. Each row correponds to a unitary test in fname, and the
......@@ -18,7 +18,7 @@ function [check, info] = mtest(fname, fpath)
% Column 4 Details about the failure (vector of 0 and 1).
% Column 5 Elapsed time in seconds.
%
% REMARKS
% REMARKS
% - If only one input argument is provided, fname must be a string containing the
% full path to the targeted matlab routine.
% - If two input arguments are provided, fname is the base name of the targeted
......@@ -34,8 +34,8 @@ function [check, info] = mtest(fname, fpath)
% (at your option) any later version.
%
% Dynare's m-unit-tests module 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
% 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
......@@ -161,6 +161,6 @@ end
function file = append_extension_if_needed(file)
if ~isequal(file(end-1:end),'.m')
file = [file '.m'];
end
\ No newline at end of file
if ~isequal(file(end-1:end),'.m')
file = [file '.m'];
end
\ No newline at end of file
......@@ -2,11 +2,11 @@ function [report, time] = run_unitary_tests(listoffiles)
% Runs unitary tests defined in a collection of files.
%
% INPUTS
% INPUTS
% - listoffiles [cell], The list of m files (with path) where the unitary tests are written.
% This cell, with n elements, is the output of get_directory_description routine.
%
% OUTPUTS
% OUTPUTS
% - report [cell], Results of the unitary tests (n rows and 5 columns). Each row stores
% the second output argument of mtest routine (info).
% - time [double], Current date and time as date vector.
......
......@@ -2,16 +2,16 @@ function report = run_unitary_tests_in_directory(dirname, savereport, printrepor
% Runs all the unitary tests defined in a directory (and subfolders).
%
% INPUTS
% INPUTS
% - dirname [string], name of the directory where
% - savereport [integer], scalar equal to 0 or 1. If equal to 1 the report is saved in a mat file.
% - printreport [integer], scalar equal to 0 or 1. If equal to 1 the report is printed on screen.
% - sendreport [integer], scalar equal to 0 or 1. If equal to 1 the report is sent by email.
%
% OUTPUTS
% OUTPUTS
% - report [cell], first output argument of run_unitary_test routine.
%
% REMARKS
% REMARKS
% 1. Git needs to be available on the system and it is assumed that the content of dirname is versionned with Git.
%
% See also get_directory_description, run_unitary_tests, build_report_summary
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment