log.m 1.88 KB
Newer Older
1
function o = log(o) % --*-- Unitary tests --*--
2

3 4
% Apply the logarithm to all the variables in a dseries object (without in place modification).
%
Stéphane Adjemian's avatar
Stéphane Adjemian committed
5
% INPUTS
6 7
% - o [dseries]
%
Stéphane Adjemian's avatar
Stéphane Adjemian committed
8
% OUTPUTS
9
% - o [dseries]
10

11
% Copyright (C) 2011-2017 Dynare Team
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
o = copy(o);
o.log_;

%@test:1
%$ % Define a dates object
%$ data = ones(10,2);
%$ o = dseries(data);
%$ q = dseries(data);
%$
%$ % Call the tested routine.
%$ try
%$     p = o.log();
%$     t(1) = true;
%$ catch
%$     t(1) = false;
%$ end
Stéphane Adjemian's avatar
Stéphane Adjemian committed
44
%$
45 46 47 48 49 50 51
%$ if t(1)
%$      t(2) = dassert(o, q);
%$      t(3) = dassert(p.data, zeros(10, 2));
%$ end
%$
%$ T = all(t);
%@eof:1
52

53 54 55 56 57 58 59 60 61 62 63 64 65
%@test:2
%$ % Define a dates object
%$ data = ones(10,2);
%$ o = dseries(data);
%$ q = dseries(data);
%$
%$ % Call the tested routine.
%$ try
%$     p = o.log();
%$     t(1) = true;
%$ catch
%$     t(1) = false;
%$ end
Stéphane Adjemian's avatar
Stéphane Adjemian committed
66
%$
67 68
%$ if t(1)
%$      t(2) = dassert(length(p.name), 2);
Stéphane Adjemian's avatar
Stéphane Adjemian committed
69 70
%$      t(3) = dassert(p.name{1},'Variable_1');
%$      t(4) = dassert(p.name{2},'Variable_2');
71 72
%$      t(5) = dassert(o.name{1},'Variable_1');
%$      t(6) = dassert(o.name{2},'Variable_2');
Stéphane Adjemian's avatar
Stéphane Adjemian committed
73 74 75 76
%$      t(7) = dassert(p.ops{1},'log(Variable_1)');
%$      t(8) = dassert(p.ops{2},'log(Variable_2)');
%$      t(9) = isempty(o.ops{1});
%$      t(10) = isempty(o.ops{2});
77 78 79 80
%$ end
%$
%$ T = all(t);
%@eof:2