Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Dynare
dseries
Commits
bb8fcba8
Commit
bb8fcba8
authored
Oct 25, 2016
by
Stéphane Adjemian (Charybdis)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit tests.
parent
25eefcff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
src/@dseries/firstdate.m
src/@dseries/firstdate.m
+19
-3
src/@dseries/isnan.m
src/@dseries/isnan.m
+23
-2
No files found.
src/@dseries/firstdate.m
View file @
bb8fcba8
function
f
=
firstdate
(
o
)
function
f
=
firstdate
(
o
)
% --*-- Unitary tests --*--
% Copyright (C) 201
4
Dynare Team
% Copyright (C) 201
6
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
src/@dseries/isnan.m
View file @
bb8fcba8
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment