Fixed bug.

'A', 'Q', '1900Q', 'Q1', 'M', '1900M', 'M1','W', '1900W' and 'W1'
should not be interpreted as dates.
parent 75d3341b
......@@ -26,7 +26,7 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$','once'))
if isempty(regexp(str,'^-?[0-9]+[Mm]([1-9]|1[0-2])$','once'))
b = false;
else
b = true;
......
......@@ -26,7 +26,7 @@ function b = isquarterly(str) % --*-- Unitary tests --*--
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$','once'))
if isempty(regexp(str,'^-?[0-9]+[Qq][1-4]$','once'))
b = false;
else
b = true;
......
......@@ -41,6 +41,13 @@ end
%$ date_6 = '1950Y';
%$ date_7 = '-1950a';
%$ date_8 = '1950m ';
%$ date_9 = 'A';
%$ date_10 = '1938Q';
%$ date_11 = 'Q4';
%$ date_12 = '1938M';
%$ date_13 = 'M11';
%$ date_14 = '1W';
%$ date_15 = 'W1';
%$
%$ t(1) = dassert(isstringdate(date_1),true);
%$ t(2) = dassert(isstringdate(date_2),true);
......@@ -50,5 +57,13 @@ end
%$ t(6) = dassert(isstringdate(date_6),true);
%$ t(7) = dassert(isstringdate(date_7),true);
%$ t(8) = dassert(isstringdate(date_8),false);
%$ t(9) = dassert(isstringdate(date_9),false);
%$ t(10) = dassert(isstringdate(date_10),false);
%$ t(11) = dassert(isstringdate(date_11),false);
%$ t(12) = dassert(isstringdate(date_12),false);
%$ t(13) = dassert(isstringdate(date_13),false);
%$ t(14) = dassert(isstringdate(date_14),false);
%$ t(15) = dassert(isstringdate(date_15),false);
%$
%$ T = all(t);
%@eof:1
\ No newline at end of file
......@@ -26,7 +26,7 @@ function b = isweekly(str) % --*-- Unitary tests --*--
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$','once'))
if isempty(regexp(str,'^-?[0-9]+[Ww]([1-9]|[1-4][0-9]|5[0-2])$','once'))
b = false;
else
b = true;
......
......@@ -26,7 +26,7 @@ function b = isyearly(str) % --*-- Unitary tests --*--
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[YyAa]$','once'))
if isempty(regexp(str,'^-?[0-9]+[YyAa]$','once'))
b = false;
else
b = true;
......
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