1function p = copy(o) % --*-- Unitary tests --*--
2
3% Do a copy of a dseries object.
4%
5% INPUTS
6% - o [dates]
7%
8% OUTPUTS
9% - p [dates]
10
11% Copyright (C) 2015-2017 Dynare Team
12%
13% This code is free software: you can redistribute it and/or modify
14% it under the terms of the GNU General Public License as published by
15% the Free Software Foundation, either version 3 of the License, or
16% (at your option) any later version.
17%
18% Dynare dseries submodule is distributed in the hope that it will be useful,
19% but WITHOUT ANY WARRANTY; without even the implied warranty of
20% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21% GNU General Public License for more details.
22%
23% You should have received a copy of the GNU General Public License
24% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
25
26p = dseries();
27p.data  = o.data;
28p.name  = o.name;
29p.tex   = o.tex;
30p.dates = o.dates;
31p.ops   = o.ops;
32p.tags  = o.tags;
33
34%@test:1
35%$ % Define a dates object
36%$ data = rand(10,2);
37%$ o = dseries(data);
38%$ q = dseries(data);
39%$
40%$ % Call the tested routine.
41%$ try
42%$     p = copy(o);
43%$     t(1) = true;
44%$ catch
45%$     t(1) = false;
46%$ end
47%$
48%$ if t(1)
49%$      o.log_();
50%$      t(2) = dassert(p, q);
51%$ end
52%$
53%$ T = all(t);
54%@eof:1