diff --git a/src/@dseries/firstdate.m b/src/@dseries/firstdate.m index 9a7db50ea427161d35e0a58e8a83900a07d14349..2ba943b2d738324b1db43db5133ddf50ac4ccf4a 100644 --- a/src/@dseries/firstdate.m +++ b/src/@dseries/firstdate.m @@ -1,6 +1,6 @@ -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 diff --git a/src/@dseries/isnan.m b/src/@dseries/isnan.m index d2c79b14ea541641ba2d0e41c1813a7a0b3d3de6..4169415da2c4126dd02e6ac93d2a3970f56e5d1b 100644 --- a/src/@dseries/isnan.m +++ b/src/@dseries/isnan.m @@ -1,4 +1,4 @@ -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