7 using namespace boost::unit_test_framework;
21 void testSmallerOrEqual();
23 void testGreaterOrEqual();
24 void testCopyConstruct();
26 void testThreadedCreation();
27 void testStringConvert();
57 framework::master_test_suite().p_name.value =
"VersionNumber test suite";
63 BOOST_CHECK((v1 == v1));
64 BOOST_CHECK(!(v1 == v2));
65 BOOST_CHECK(!(v1 == v3));
66 BOOST_CHECK(!(v1 == v4));
68 BOOST_CHECK(!(v2 == v1));
69 BOOST_CHECK((v2 == v2));
70 BOOST_CHECK(!(v2 == v3));
71 BOOST_CHECK(!(v2 == v4));
73 BOOST_CHECK(!(v3 == v1));
74 BOOST_CHECK(!(v3 == v2));
75 BOOST_CHECK((v3 == v3));
76 BOOST_CHECK(!(v3 == v4));
78 BOOST_CHECK(!(v4 == v1));
79 BOOST_CHECK(!(v4 == v2));
80 BOOST_CHECK(!(v4 == v3));
81 BOOST_CHECK((v4 == v4));
85 BOOST_CHECK(!(v1 != v1));
86 BOOST_CHECK((v1 != v2));
87 BOOST_CHECK((v1 != v3));
88 BOOST_CHECK((v1 != v4));
90 BOOST_CHECK((v2 != v1));
91 BOOST_CHECK(!(v2 != v2));
92 BOOST_CHECK((v2 != v3));
93 BOOST_CHECK((v2 != v4));
95 BOOST_CHECK((v3 != v1));
96 BOOST_CHECK((v3 != v2));
97 BOOST_CHECK(!(v3 != v3));
98 BOOST_CHECK((v3 != v4));
100 BOOST_CHECK((v4 != v1));
101 BOOST_CHECK((v4 != v2));
102 BOOST_CHECK((v4 != v3));
103 BOOST_CHECK(!(v4 != v4));
107 BOOST_CHECK(!(v1 < v1));
108 BOOST_CHECK((v1 < v2));
109 BOOST_CHECK((v1 < v3));
110 BOOST_CHECK((v1 < v4));
112 BOOST_CHECK(!(v2 < v1));
113 BOOST_CHECK(!(v2 < v2));
114 BOOST_CHECK((v2 < v3));
115 BOOST_CHECK((v2 < v4));
117 BOOST_CHECK(!(v3 < v1));
118 BOOST_CHECK(!(v3 < v2));
119 BOOST_CHECK(!(v3 < v3));
120 BOOST_CHECK((v3 < v4));
122 BOOST_CHECK(!(v4 < v1));
123 BOOST_CHECK(!(v4 < v2));
124 BOOST_CHECK(!(v4 < v3));
125 BOOST_CHECK(!(v4 < v4));
129 BOOST_CHECK((v1 <= v1));
130 BOOST_CHECK((v1 <= v2));
131 BOOST_CHECK((v1 <= v3));
132 BOOST_CHECK((v1 <= v4));
134 BOOST_CHECK(!(v2 <= v1));
135 BOOST_CHECK((v2 <= v2));
136 BOOST_CHECK((v2 <= v3));
137 BOOST_CHECK((v2 <= v4));
139 BOOST_CHECK(!(v3 <= v1));
140 BOOST_CHECK(!(v3 <= v2));
141 BOOST_CHECK((v3 <= v3));
142 BOOST_CHECK((v3 <= v4));
144 BOOST_CHECK(!(v4 <= v1));
145 BOOST_CHECK(!(v4 <= v2));
146 BOOST_CHECK(!(v4 <= v3));
147 BOOST_CHECK((v4 <= v4));
151 BOOST_CHECK(!(v1 > v1));
152 BOOST_CHECK(!(v1 > v2));
153 BOOST_CHECK(!(v1 > v3));
154 BOOST_CHECK(!(v1 > v4));
156 BOOST_CHECK((v2 > v1));
157 BOOST_CHECK(!(v2 > v2));
158 BOOST_CHECK(!(v2 > v3));
159 BOOST_CHECK(!(v2 > v4));
161 BOOST_CHECK((v3 > v1));
162 BOOST_CHECK((v3 > v2));
163 BOOST_CHECK(!(v3 > v3));
164 BOOST_CHECK(!(v3 > v4));
166 BOOST_CHECK((v4 > v1));
167 BOOST_CHECK((v4 > v2));
168 BOOST_CHECK((v4 > v3));
169 BOOST_CHECK(!(v4 > v4));
173 BOOST_CHECK((v1 >= v1));
174 BOOST_CHECK(!(v1 >= v2));
175 BOOST_CHECK(!(v1 >= v3));
176 BOOST_CHECK(!(v1 >= v4));
178 BOOST_CHECK((v2 >= v1));
179 BOOST_CHECK((v2 >= v2));
180 BOOST_CHECK(!(v2 >= v3));
181 BOOST_CHECK(!(v2 >= v4));
183 BOOST_CHECK((v3 >= v1));
184 BOOST_CHECK((v3 >= v2));
185 BOOST_CHECK((v3 >= v3));
186 BOOST_CHECK(!(v3 >= v4));
188 BOOST_CHECK((v4 >= v1));
189 BOOST_CHECK((v4 >= v2));
190 BOOST_CHECK((v4 >= v3));
191 BOOST_CHECK((v4 >= v4));
200 BOOST_CHECK(v1copied == v1);
201 BOOST_CHECK(v2copied == v2);
202 BOOST_CHECK(v3copied == v3);
203 BOOST_CHECK(v4copied == v4);
205 BOOST_CHECK(v1copied != v2);
206 BOOST_CHECK(v1copied != v3);
207 BOOST_CHECK(v1copied != v4);
208 BOOST_CHECK(v2copied != v3);
209 BOOST_CHECK(v2copied != v4);
210 BOOST_CHECK(v3copied != v4);
219 BOOST_CHECK(v1assigned > v4);
220 BOOST_CHECK(v2assigned > v4);
221 BOOST_CHECK(v3assigned > v4);
222 BOOST_CHECK(v4assigned > v4);
229 BOOST_CHECK(v1assigned == v1);
230 BOOST_CHECK(v2assigned == v2);
231 BOOST_CHECK(v3assigned == v3);
232 BOOST_CHECK(v4assigned == v4);
235 BOOST_CHECK(v1assigned > v4assigned);
238 BOOST_CHECK(v2assigned > v1assigned);
241 BOOST_CHECK(v3assigned > v2assigned);
244 BOOST_CHECK(v4assigned > v3assigned);
251 BOOST_CHECK(v1assigned == v1);
252 BOOST_CHECK(v2assigned == v2);
253 BOOST_CHECK(v3assigned == v3);
254 BOOST_CHECK(v4assigned == v4);
258 std::cout <<
"Filling lists of VersionNumbers..." << std::endl;
260 std::thread t([
this] {
261 for(
int i = 0; i < 1000; ++i) this->listA.push_back(
VersionNumber());
263 for(
int i = 0; i < 1000; ++i) listB.push_back(
VersionNumber());
266 std::cout <<
"Now comparing all pairs of elements in the lists..." << std::endl;
268 for(
auto& a : listA) {
269 for(
auto& b : listB) {
272 int nSelfMatches = 0;
273 for(
auto& a2 : listA) {
274 if(a == a2) nSelfMatches++;
276 BOOST_CHECK_EQUAL(nSelfMatches, 1);
279 for(
auto& b : listB) {
280 int nSelfMatches = 0;
281 for(
auto& b2 : listB) {
282 if(b == b2) nSelfMatches++;
284 BOOST_CHECK_EQUAL(nSelfMatches, 1);
287 std::cout <<
"done." << std::endl;
291 std::string s1 = (std::string)v1;
292 std::string s2 = (std::string)v2;
293 std::string s3 = (std::string)v3;
294 std::string s4 = (std::string)v4;
301 std::string s1c = (std::string)v1copied;
302 std::string s2c = (std::string)v2copied;
303 std::string s3c = (std::string)v3copied;
304 std::string s4c = (std::string)v4copied;
306 BOOST_CHECK(s1 !=
"");
307 BOOST_CHECK(s2 !=
"");
308 BOOST_CHECK(s3 !=
"");
309 BOOST_CHECK(s4 !=
"");
311 BOOST_CHECK(s1c !=
"");
312 BOOST_CHECK(s2c !=
"");
313 BOOST_CHECK(s3c !=
"");
314 BOOST_CHECK(s4c !=
"");
316 BOOST_CHECK_EQUAL(s1, s1c);
317 BOOST_CHECK_EQUAL(s2, s2c);
318 BOOST_CHECK_EQUAL(s3, s3c);
319 BOOST_CHECK_EQUAL(s4, s4c);
325 BOOST_CHECK(vv0.
getTime() >= t0);
333 BOOST_CHECK(vv2.
getTime() < t1);