From 70fcfb8fddeca8ebf3341e7c30c17654e7e37111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= <stephane.adjemian@univ-lemans.fr> Date: Thu, 19 Nov 2015 12:06:23 +0100 Subject: [PATCH] Use true/false instead of 1/0. --- src/utilities/is/isfreq.m | 6 +++--- src/utilities/is/ismonthly.m | 22 +++++++++++----------- src/utilities/is/isquaterly.m | 20 ++++++++++---------- src/utilities/is/isstringdate.m | 2 +- src/utilities/is/isweekly.m | 24 ++++++++++++------------ src/utilities/is/isyearly.m | 22 +++++++++++----------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/utilities/is/isfreq.m b/src/utilities/is/isfreq.m index 79ba42c..f552bdc 100644 --- a/src/utilities/is/isfreq.m +++ b/src/utilities/is/isfreq.m @@ -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 diff --git a/src/utilities/is/ismonthly.m b/src/utilities/is/ismonthly.m index b722b35..bdf7e24 100644 --- a/src/utilities/is/ismonthly.m +++ b/src/utilities/is/ismonthly.m @@ -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 diff --git a/src/utilities/is/isquaterly.m b/src/utilities/is/isquaterly.m index d8d8146..8171ca3 100644 --- a/src/utilities/is/isquaterly.m +++ b/src/utilities/is/isquaterly.m @@ -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 diff --git a/src/utilities/is/isstringdate.m b/src/utilities/is/isstringdate.m index d9c6d5e..56fe59c 100644 --- a/src/utilities/is/isstringdate.m +++ b/src/utilities/is/isstringdate.m @@ -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 diff --git a/src/utilities/is/isweekly.m b/src/utilities/is/isweekly.m index b7fbe93..4cdd200 100644 --- a/src/utilities/is/isweekly.m +++ b/src/utilities/is/isweekly.m @@ -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 diff --git a/src/utilities/is/isyearly.m b/src/utilities/is/isyearly.m index bf8c035..7950865 100644 --- a/src/utilities/is/isyearly.m +++ b/src/utilities/is/isyearly.m @@ -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 -- GitLab