]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/interval/test/cmp_tribool.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / numeric / interval / test / cmp_tribool.cpp
1 /* Boost test/cmp_tribool.cpp
2 * test compare::tribool
3 *
4 * Copyright 2004 Guillaume Melquiond
5 *
6 * Distributed under the Boost Software License, Version 1.0.
7 * (See accompanying file LICENSE_1_0.txt or
8 * copy at http://www.boost.org/LICENSE_1_0.txt)
9 */
10
11 #include "cmp_header.hpp"
12 #include <boost/numeric/interval/compare/tribool.hpp>
13
14 using namespace boost::numeric::interval_lib::compare::tribool;
15
16 // comparisons between [1,2] and [3,4]
17
18 static void test_12_34() {
19 const I a(1,2), b(3,4);
20
21 BOOST_CHECK(a < b);
22 BOOST_CHECK(a <= b);
23 BOOST_CHECK(!(a > b));
24 BOOST_CHECK(!(a >= b));
25
26 BOOST_CHECK(b > a);
27 BOOST_CHECK(b >= a);
28 BOOST_CHECK(!(b < a));
29 BOOST_CHECK(!(b <= a));
30
31 BOOST_CHECK(!(a == b));
32 BOOST_CHECK(a != b);
33
34 # ifdef BOOST_BORLANDC
35 ::detail::ignore_unused_variable_warning(a);
36 ::detail::ignore_unused_variable_warning(b);
37 # endif
38 }
39
40 // comparisons between [1,3] and [2,4]
41
42 static void test_13_24() {
43 const I a(1,3), b(2,4);
44
45 BOOST_CHECK(indeterminate(a < b));
46 BOOST_CHECK(indeterminate(a <= b));
47 BOOST_CHECK(indeterminate(a > b));
48 BOOST_CHECK(indeterminate(a >= b));
49
50 BOOST_CHECK(indeterminate(b < a));
51 BOOST_CHECK(indeterminate(b <= a));
52 BOOST_CHECK(indeterminate(b > a));
53 BOOST_CHECK(indeterminate(b >= a));
54
55 BOOST_CHECK(indeterminate(a == b));
56 BOOST_CHECK(indeterminate(a != b));
57
58 # ifdef BOOST_BORLANDC
59 ::detail::ignore_unused_variable_warning(a);
60 ::detail::ignore_unused_variable_warning(b);
61 # endif
62 }
63
64 // comparisons between [1,2] and [2,3]
65
66 static void test_12_23() {
67 const I a(1,2), b(2,3);
68
69 BOOST_CHECK(indeterminate(a < b));
70 BOOST_CHECK(a <= b);
71 BOOST_CHECK(!(a > b));
72 BOOST_CHECK(indeterminate(a >= b));
73
74 BOOST_CHECK(!(b < a));
75 BOOST_CHECK(indeterminate(b <= a));
76 BOOST_CHECK(indeterminate(b > a));
77 BOOST_CHECK(b >= a);
78
79 BOOST_CHECK(indeterminate(a == b));
80 BOOST_CHECK(indeterminate(a != b));
81
82 # ifdef BOOST_BORLANDC
83 ::detail::ignore_unused_variable_warning(a);
84 ::detail::ignore_unused_variable_warning(b);
85 # endif
86 }
87
88 // comparisons between [1,2] and 0
89
90 static void test_12_0() {
91 const I a(1,2);
92 const int b = 0;
93
94 BOOST_CHECK(!(a < b));
95 BOOST_CHECK(!(a <= b));
96 BOOST_CHECK(a > b);
97 BOOST_CHECK(a >= b);
98
99 BOOST_CHECK(!(a == b));
100 BOOST_CHECK(a != b);
101
102 # ifdef BOOST_BORLANDC
103 ::detail::ignore_unused_variable_warning(a);
104 ::detail::ignore_unused_variable_warning(b);
105 # endif
106 }
107
108 // comparisons between [1,2] and 1
109
110 static void test_12_1() {
111 const I a(1,2);
112 const int b = 1;
113
114 BOOST_CHECK(!(a < b));
115 BOOST_CHECK(indeterminate(a <= b));
116 BOOST_CHECK(indeterminate(a > b));
117 BOOST_CHECK(a >= b);
118
119 BOOST_CHECK(indeterminate(a == b));
120 BOOST_CHECK(indeterminate(a != b));
121
122 # ifdef BOOST_BORLANDC
123 ::detail::ignore_unused_variable_warning(a);
124 ::detail::ignore_unused_variable_warning(b);
125 # endif
126 }
127
128 // comparisons between [1,2] and 2
129
130 static void test_12_2() {
131 const I a(1,2);
132 const int b = 2;
133
134 BOOST_CHECK(indeterminate(a < b));
135 BOOST_CHECK(a <= b);
136 BOOST_CHECK(!(a > b));
137 BOOST_CHECK(indeterminate(a >= b));
138
139 BOOST_CHECK(indeterminate(a == b));
140 BOOST_CHECK(indeterminate(a != b));
141
142 # ifdef BOOST_BORLANDC
143 ::detail::ignore_unused_variable_warning(a);
144 ::detail::ignore_unused_variable_warning(b);
145 # endif
146 }
147
148 // comparisons between [1,2] and 3
149
150 static void test_12_3() {
151 const I a(1,2);
152 const int b = 3;
153
154 BOOST_CHECK(a < b);
155 BOOST_CHECK(a <= b);
156 BOOST_CHECK(!(a > b));
157 BOOST_CHECK(!(a >= b));
158
159 BOOST_CHECK(!(a == b));
160 BOOST_CHECK(a != b);
161
162 # ifdef BOOST_BORLANDC
163 ::detail::ignore_unused_variable_warning(a);
164 ::detail::ignore_unused_variable_warning(b);
165 # endif
166 }
167
168 // comparisons between [1,2] and [1,2]
169
170 static void test_12_12() {
171 const I a(1,2), b(1,2);
172
173 BOOST_CHECK(indeterminate(a == b));
174 BOOST_CHECK(indeterminate(a != b));
175
176 # ifdef BOOST_BORLANDC
177 ::detail::ignore_unused_variable_warning(a);
178 ::detail::ignore_unused_variable_warning(b);
179 # endif
180 }
181
182 // comparisons between [1,1] and [1,1]
183
184 static void test_11_11() {
185 const I a(1,1), b(1,1);
186
187 BOOST_CHECK(a == b);
188 BOOST_CHECK(!(a != b));
189
190 # ifdef BOOST_BORLANDC
191 ::detail::ignore_unused_variable_warning(a);
192 ::detail::ignore_unused_variable_warning(b);
193 # endif
194 }
195
196 // comparisons between [1,1] and 1
197
198 static void test_11_1() {
199 const I a(1,1);
200 const int b = 1;
201
202 BOOST_CHECK(a == b);
203 BOOST_CHECK(!(a != b));
204
205 # ifdef BOOST_BORLANDC
206 ::detail::ignore_unused_variable_warning(a);
207 ::detail::ignore_unused_variable_warning(b);
208 # endif
209 }
210
211 int test_main(int, char *[]) {
212 test_12_34();
213 test_13_24();
214 test_12_23();
215 test_12_0();
216 test_12_1();
217 test_12_2();
218 test_12_3();
219 test_12_12();
220 test_11_11();
221 test_11_1();
222
223 return 0;
224 }