Skip to content
Snippets Groups Projects
Commit 33b72934 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added unit tests.

(cherry picked from commit bb8fcba8)
parent 64b6e0dc
Branches
No related tags found
No related merge requests found
function f = firstdate(o)
function f = firstdate(o) % --*-- Unitary tests --*--
% Copyright (C) 2014 Dynare Team
% Copyright (C) 2016 Dynare Team
%
% This file is part of Dynare.
%
......@@ -17,4 +17,20 @@ function f = firstdate(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
f = o.dates(1);
\ No newline at end of file
f = o.dates(1);
%@test:1
%$ try
%$ ts = dseries(randn(10, 3),'1938Q3');
%$ dd = ts.firstdate();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ if t(1)
%$ t(2) = isequal(dd, dates('1938Q3'));
%$ end
%$
%$ T = all(t);
%@eof:1
function b = isnan(o)
function b = isnan(o) % --*-- Unitary tests --*--
% Returns an array of logicals (true/false). Element (t,i) is true iff the i-th variable at
% period number t is not a NaN.
......@@ -27,4 +27,25 @@ function b = isnan(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
b = isnan(o.data);
\ No newline at end of file
b = isnan(o.data);
%@test:1
%$ try
%$ data = randn(100, 10);
%$ cnan = randi(10, 50, 1);
%$ rnan = randi(100, 50, 1);
%$ for i=1:50, data(rnan(i),cnan(i)) = NaN; end
%$ inan = isnan(data);
%$ ts = dseries(data);
%$ dd = ts.isnan();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ if t(1)
%$ t(2) = isequal(dd, inan);
%$ end
%$
%$ T = all(t);
%@eof:1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment