Added condition (input must be a string) in isyearly, isquaterly, ismonthly and isweekly functions.
parent
941d7b7c5d
commit
068564628d
|
@ -25,7 +25,11 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
|
||||||
% 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/>.
|
||||||
|
|
||||||
|
if ischar(str)
|
||||||
b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
|
b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
|
||||||
|
else
|
||||||
|
b = 0;
|
||||||
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$
|
%$
|
||||||
|
|
|
@ -25,7 +25,11 @@ function b = isquaterly(str) % --*-- Unitary tests --*--
|
||||||
% 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/>.
|
||||||
|
|
||||||
|
if ischar(str)
|
||||||
b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
|
b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
|
||||||
|
else
|
||||||
|
b = 0;
|
||||||
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$
|
%$
|
||||||
|
|
|
@ -25,7 +25,11 @@ function b = isweekly(str) % --*-- Unitary tests --*--
|
||||||
% 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/>.
|
||||||
|
|
||||||
|
if ischar(str)
|
||||||
b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
|
b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
|
||||||
|
else
|
||||||
|
b = 0;
|
||||||
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$
|
%$
|
||||||
|
|
|
@ -25,7 +25,11 @@ function b = isyearly(str) % --*-- Unitary tests --*--
|
||||||
% 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/>.
|
||||||
|
|
||||||
|
if ischar(str)
|
||||||
b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
|
b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
|
||||||
|
else
|
||||||
|
b = 0;
|
||||||
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$
|
%$
|
||||||
|
|
Loading…
Reference in New Issue