Skip to content
Snippets Groups Projects
Verified Commit 3a47109c authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added unit test for daily frequency + cosmetic changes.

parent 4ab4138b
Branches
No related tags found
No related merge requests found
......@@ -3,12 +3,12 @@ function b = isdate(str) % --*-- Unitary tests --*--
% Tests if the input string can be interpreted as a date.
%
% INPUTS
% o str string.
% - str [char] 1×m array, date (potentially)
%
% OUTPUTS
% o b integer scalar, equal to 1 if str can be interpreted as a date or 0 otherwise.
% - b [logical] scalar equal to true iff str can be interpreted as a date.
% Copyright (C) 2013-2017 Dynare Team
% Copyright © 2013-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -32,24 +32,29 @@ end
b = isstringdate(str);
return
%@test:1
%$
%$ date_1 = 1950;
%$ date_2 = '1950m2';
%$ date_3 = '-1950m2';
%$ date_4 = '1950m52';
%$ date_5 = ' 1950';
%$ date_6 = '1950Y';
%$ date_7 = '-1950a';
%$ date_8 = '1950m ';
%$
%$ t(1) = dassert(isdate(date_1),true);
%$ t(2) = dassert(isdate(date_2),true);
%$ t(3) = dassert(isdate(date_3),true);
%$ t(4) = dassert(isdate(date_4),false);
%$ t(5) = dassert(isdate(date_5),false);
%$ t(6) = dassert(isdate(date_6),true);
%$ t(7) = dassert(isdate(date_7),true);
%$ t(8) = dassert(isdate(date_8),false);
%$ T = all(t);
date_1 = 1950;
date_2 = '1950m2';
date_3 = '-1950m2';
date_4 = '1950m52';
date_5 = ' 1950';
date_6 = '1950Y';
date_7 = '-1950a';
date_8 = '1950m ';
date_9 = '2000-01-01';
date_10 = '2000-02-30';
t(1) = isequal(isdate(date_1), true);
t(2) = isequal(isdate(date_2), true);
t(3) = isequal(isdate(date_3), true);
t(4) = isequal(isdate(date_4), false);
t(5) = isequal(isdate(date_5), false);
t(6) = isequal(isdate(date_6), true);
t(7) = isequal(isdate(date_7), true);
t(8) = isequal(isdate(date_8), false);
t(9) = isequal(isdate(date_9), true);
t(10) = isequal(isdate(date_10), false);
T = all(t);
%@eof:1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment