Skip to content
Snippets Groups Projects
Commit 70fcfb8f authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Use true/false instead of 1/0.

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