1function o = log(o) % --*-- Unitary tests --*--
2
3% Apply the logarithm to all the variables in a dseries object (without in place modification).
4%
5% INPUTS
6% - o [dseries]
7%
8% OUTPUTS
9% - o [dseries]
10
11% Copyright (C) 2011-2017 Dynare Team
12%
13% This file is part of Dynare.
14%
15% Dynare is free software: you can redistribute it and/or modify
16% it under the terms of the GNU General Public License as published by
17% the Free Software Foundation, either version 3 of the License, or
18% (at your option) any later version.
19%
20% Dynare is distributed in the hope that it will be useful,
21% but WITHOUT ANY WARRANTY; without even the implied warranty of
22% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23% GNU General Public License for more details.
24%
25% You should have received a copy of the GNU General Public License
26% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
27
28o = copy(o);
29o.log_;
30
31%@test:1
32%$ % Define a dates object
33%$ data = ones(10,2);
34%$ o = dseries(data);
35%$ q = dseries(data);
36%$
37%$ % Call the tested routine.
38%$ try
39%$     p = o.log();
40%$     t(1) = true;
41%$ catch
42%$     t(1) = false;
43%$ end
44%$
45%$ if t(1)
46%$      t(2) = dassert(o, q);
47%$      t(3) = dassert(p.data, zeros(10, 2));
48%$ end
49%$
50%$ T = all(t);
51%@eof:1
52
53%@test:2
54%$ % Define a dates object
55%$ data = ones(10,2);
56%$ o = dseries(data);
57%$ q = dseries(data);
58%$
59%$ % Call the tested routine.
60%$ try
61%$     p = o.log();
62%$     t(1) = true;
63%$ catch
64%$     t(1) = false;
65%$ end
66%$
67%$ if t(1)
68%$      t(2) = dassert(length(p.name), 2);
69%$      t(3) = dassert(p.name{1},'Variable_1');
70%$      t(4) = dassert(p.name{2},'Variable_2');
71%$      t(5) = dassert(o.name{1},'Variable_1');
72%$      t(6) = dassert(o.name{2},'Variable_2');
73%$      t(7) = dassert(p.ops{1},'log(Variable_1)');
74%$      t(8) = dassert(p.ops{2},'log(Variable_2)');
75%$      t(9) = isempty(o.ops{1});
76%$      t(10) = isempty(o.ops{2});
77%$ end
78%$
79%$ T = all(t);
80%@eof:2