Use true/false instead of 1/0.

parent 9cd0347e
......@@ -25,15 +25,15 @@ function B = isfreq(A)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
B = 0;
B = false;
if ischar(A)
if isequal(length(A),1) && ismember(upper(A),{'Y','A','Q','M','W'})
B = 1;
B = true;
return
end
end
if isnumeric(A) && isequal(length(A),1) && ismember(A,[1 4 12 52])
B = 1;
B = true;
end
\ No newline at end of file
......@@ -27,12 +27,12 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$','once'))
b = 0;
b = false;
else
b = 1;
b = true;
end
else
b = 0;
b = false;
end
%@test:1
......@@ -46,13 +46,13 @@ end
%$ date_7 = '1950Q3';
%$ date_8 = '1950m24';
%$
%$ t(1) = dassert(ismonthly(date_1),1);
%$ t(2) = dassert(ismonthly(date_2),1);
%$ t(3) = dassert(ismonthly(date_3),1);
%$ t(4) = dassert(ismonthly(date_4),1);
%$ t(5) = dassert(ismonthly(date_5),0);
%$ t(6) = dassert(ismonthly(date_6),0);
%$ t(7) = dassert(ismonthly(date_7),0);
%$ t(8) = dassert(ismonthly(date_8),0);
%$ t(1) = dassert(ismonthly(date_1),true);
%$ t(2) = dassert(ismonthly(date_2),true);
%$ t(3) = dassert(ismonthly(date_3),true);
%$ t(4) = dassert(ismonthly(date_4),true);
%$ t(5) = dassert(ismonthly(date_5),false);
%$ t(6) = dassert(ismonthly(date_6),false);
%$ t(7) = dassert(ismonthly(date_7),false);
%$ t(8) = dassert(ismonthly(date_8),false);
%$ T = all(t);
%@eof:1
\ No newline at end of file
......@@ -27,12 +27,12 @@ function b = isquaterly(str) % --*-- Unitary tests --*--
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$','once'))
b = 0;
b = false;
else
b = 1;
b = true;
end
else
b = 0;
b = false;
end
%@test:1
......@@ -45,12 +45,12 @@ end
%$ date_6 = '1950Y';
%$ date_7 = '1950m24';
%$
%$ t(1) = dassert(isquaterly(date_1),1);
%$ t(2) = dassert(isquaterly(date_2),1);
%$ t(3) = dassert(isquaterly(date_3),1);
%$ t(4) = dassert(isquaterly(date_4),0);
%$ t(5) = dassert(isquaterly(date_5),0);
%$ t(6) = dassert(isquaterly(date_6),0);
%$ t(7) = dassert(isquaterly(date_7),0);
%$ t(1) = dassert(isquaterly(date_1),true);
%$ t(2) = dassert(isquaterly(date_2),true);
%$ t(3) = dassert(isquaterly(date_3),true);
%$ t(4) = dassert(isquaterly(date_4),false);
%$ t(5) = dassert(isquaterly(date_5),false);
%$ t(6) = dassert(isquaterly(date_6),false);
%$ t(7) = dassert(isquaterly(date_7),false);
%$ T = all(t);
%@eof:1
\ No newline at end of file
......@@ -28,7 +28,7 @@ function b = isstringdate(str) % --*-- Unitary tests --*--
if ischar(str)
b = isquaterly(str) || isyearly(str) || ismonthly(str) || isweekly(str);
else
b = 0;
b = false;
end
%@test:1
......
......@@ -27,12 +27,12 @@ function b = isweekly(str) % --*-- Unitary tests --*--
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$','once'))
b = 0;
b = false;
else
b = 1;
b = true;
end
else
b = 0;
b = false;
end
%@test:1
......@@ -41,18 +41,18 @@ end
%$ date_2 = '1950w2';
%$ date_3 = '-1950w2';
%$ date_4 = '1950w22';
%$ date_5 = '1950 azd ';
%$ date_5 = '1950 azd';
%$ date_6 = '1950Y';
%$ date_7 = '1950Q3';
%$ date_8 = '1950m54';
%$
%$ t(1) = dassert(isweekly(date_1),1);
%$ t(2) = dassert(isweekly(date_2),1);
%$ t(3) = dassert(isweekly(date_3),1);
%$ t(4) = dassert(isweekly(date_4),1);
%$ t(5) = dassert(isweekly(date_5),0);
%$ t(6) = dassert(isweekly(date_6),0);
%$ t(7) = dassert(isweekly(date_7),0);
%$ t(8) = dassert(isweekly(date_8),0);
%$ t(1) = dassert(isweekly(date_1),true);
%$ t(2) = dassert(isweekly(date_2),true);
%$ t(3) = dassert(isweekly(date_3),true);
%$ t(4) = dassert(isweekly(date_4),true);
%$ t(5) = dassert(isweekly(date_5),false);
%$ t(6) = dassert(isweekly(date_6),false);
%$ t(7) = dassert(isweekly(date_7),false);
%$ t(8) = dassert(isweekly(date_8),false);
%$ T = all(t);
%@eof:1
\ No newline at end of file
......@@ -27,12 +27,12 @@ function b = isyearly(str) % --*-- Unitary tests --*--
if ischar(str)
if isempty(regexp(str,'^-?[0-9]*[YyAa]$','once'))
b = 0;
b = false;
else
b = 1;
b = true;
end
else
b = 0;
b = false;
end
%@test:1
......@@ -46,13 +46,13 @@ end
%$ date_7 = '-1950a';
%$ date_8 = '1950m24';
%$
%$ t(1) = dassert(isyearly(date_1),0);
%$ t(2) = dassert(isyearly(date_2),0);
%$ t(3) = dassert(isyearly(date_3),0);
%$ t(4) = dassert(isyearly(date_4),0);
%$ t(5) = dassert(isyearly(date_5),0);
%$ t(6) = dassert(isyearly(date_6),1);
%$ t(7) = dassert(isyearly(date_7),1);
%$ t(8) = dassert(isyearly(date_8),0);
%$ t(1) = dassert(isyearly(date_1),false);
%$ t(2) = dassert(isyearly(date_2),false);
%$ t(3) = dassert(isyearly(date_3),false);
%$ t(4) = dassert(isyearly(date_4),false);
%$ t(5) = dassert(isyearly(date_5),false);
%$ t(6) = dassert(isyearly(date_6),true);
%$ t(7) = dassert(isyearly(date_7),true);
%$ t(8) = dassert(isyearly(date_8),false);
%$ T = all(t);
%@eof:1
\ No newline at end of file
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