1function c = lessthan(a,b) % --*-- Unitary tests --*--
2
3% Copyright (C) 2013-2019 Dynare Team
4%
5% This code is free software: you can redistribute it and/or modify
6% it under the terms of the GNU General Public License as published by
7% the Free Software Foundation, either version 3 of the License, or
8% (at your option) any later version.
9%
10% Dynare dates submodule is distributed in the hope that it will be useful,
11% but WITHOUT ANY WARRANTY; without even the implied warranty of
12% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13% GNU General Public License for more details.
14%
15% You should have received a copy of the GNU General Public License
16% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
17
18if a(1)<b(1)
19    c = true;
20else
21    if a(1)>b(1)
22        c = false;
23    else
24        if a(2)<b(2)
25            c = true;
26        else
27            c = false;
28        end
29    end
30end
31
32%@test:1
33%$ OPATH = pwd();
34%$ DSERIES_PATH = strrep(which('initialize_dseries_class'),'/initialize_dseries_class.m','');
35%$ cd([DSERIES_PATH '/@dates/private']);
36%$
37%$ a = [2, 4];
38%$ b = [1, 2];
39%$
40%$ try
41%$     boolean = lessthan(a, b);
42%$     t(1) = true;
43%$ catch
44%$     t(1) = false;
45%$ end
46%$
47%$ if t(1)
48%$     t(2) = dassert(boolean, false);
49%$ end
50%$
51%$ T = all(t);
52%$ cd(OPATH);
53%@eof:1
54
55%@test:2
56%$ OPATH = pwd();
57%$ DSERIES_PATH = strrep(which('initialize_dseries_class'),'/initialize_dseries_class.m','');
58%$ cd([DSERIES_PATH '/@dates/private']);
59%$
60%$ a = [1, 4];
61%$ b = [2, 2];
62%$
63%$ try
64%$     boolean = lessthan(a, b);
65%$     t(1) = true;
66%$ catch
67%$     t(1) = false;
68%$ end
69%$
70%$ if t(1)
71%$     t(2) = dassert(boolean, true);
72%$ end
73%$
74%$ T = all(t);
75%$ cd(OPATH);
76%@eof:2
77
78%@test:3
79%$ OPATH = pwd();
80%$ DSERIES_PATH = strrep(which('initialize_dseries_class'),'/initialize_dseries_class.m','');
81%$ cd([DSERIES_PATH '/@dates/private']);
82%$
83%$ a = [1, 4];
84%$ b = [1, 2];
85%$
86%$ try
87%$     boolean = lessthan(a, b);
88%$     t(1) = true;
89%$ catch
90%$     t(1) = false;
91%$ end
92%$
93%$ if t(1)
94%$     t(2) = dassert(boolean, false);
95%$ end
96%$
97%$ T = all(t);
98%$ cd(OPATH);
99%@eof:3
100
101%@test:4
102%$ OPATH = pwd();
103%$ DSERIES_PATH = strrep(which('initialize_dseries_class'),'/initialize_dseries_class.m','');
104%$ cd([DSERIES_PATH '/@dates/private']);
105%$
106%$ a = [1, 2];
107%$ b = [1, 4];
108%$
109%$ try
110%$     boolean = lessthan(a, b);
111%$     t(1) = true;
112%$ catch
113%$     t(1) = false;
114%$ end
115%$
116%$ if t(1)
117%$     t(2) = dassert(boolean, true);
118%$ end
119%$
120%$ T = all(t);
121%$ cd(OPATH);
122%@eof:4
123
124%@test:5
125%$ OPATH = pwd();
126%$ DSERIES_PATH = strrep(which('initialize_dseries_class'),'/initialize_dseries_class.m','');
127%$ cd([DSERIES_PATH '/@dates/private']);
128%$
129%$ a = [1, 2];
130%$ b = [1, 2];
131%$
132%$ try
133%$     boolean = lessthan(a, b);
134%$     t(1) = true;
135%$ catch
136%$     t(1) = false;
137%$ end
138%$
139%$ if t(1)
140%$     t(2) = dassert(boolean, false);
141%$ end
142%$
143%$ T = all(t);
144%$ cd(OPATH);
145%@eof:5