]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/predef/test/version.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / predef / test / version.cpp
1 /*
2 Copyright Rene Rivera 2011-2012
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6 */
7 #include <boost/predef/version_number.h>
8 #include <exception>
9 #include <vector>
10 #include <string>
11 #include <iostream>
12
13 namespace
14 {
15 struct test_info
16 {
17 std::string value;
18 bool passed;
19
20 test_info(std::string const & v, bool p) : value(v), passed(p) {}
21 test_info(test_info const & o) : value(o.value), passed(o.passed) {}
22 };
23
24 std::vector<test_info> test_results;
25 }
26
27 #define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X)))
28
29 void test_BOOST_VERSION_NUMBER()
30 {
31 PREDEF_CHECK(BOOST_VERSION_NUMBER(0,0,1) == 1L);
32 PREDEF_CHECK(BOOST_VERSION_NUMBER(99,99,99999) == 999999999L);
33 PREDEF_CHECK(BOOST_VERSION_NUMBER(299UL,99UL,99999UL) != 2999999999UL);
34 PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) != 1009999999L);
35 PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) == 9999999L);
36 PREDEF_CHECK(BOOST_VERSION_NUMBER(100,100,100000) == 0L);
37 }
38
39 int main()
40 {
41 test_BOOST_VERSION_NUMBER();
42
43 unsigned fail_count = 0;
44 std::vector<test_info>::iterator i = test_results.begin();
45 std::vector<test_info>::iterator e = test_results.end();
46 for (; i != e; ++i)
47 {
48 std::cout
49 << (i->passed ? "[passed]" : "[failed]")
50 << " " << i->value
51 << std::endl;
52 fail_count += i->passed ? 0 : 1;
53 }
54 std::cout
55 << std::endl
56 << "TOTAL: "
57 << "passed " << (test_results.size()-fail_count) << ", "
58 << "failed " << (fail_count) << ", "
59 << "of " << (test_results.size())
60 << std::endl;
61 return fail_count;
62 }