• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 Copyright Rene Rivera 2011-2017
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 <boost/predef/other/workaround.h>
9 #include <exception>
10 #include <vector>
11 #include <string>
12 #include <iostream>
13 
14 namespace
15 {
16     struct test_info
17     {
18         std::string value;
19         bool passed;
20 
test_info__anon744e07820111::test_info21         test_info(std::string const & v, bool p) : value(v), passed(p) {}
test_info__anon744e07820111::test_info22         test_info(test_info const & o) : value(o.value), passed(o.passed) {}
23     };
24 
25     std::vector<test_info> test_results;
26 }
27 
28 #define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X)))
29 
test_BOOST_PREDEF_WORKAROUND()30 void test_BOOST_PREDEF_WORKAROUND()
31 {
32     PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(15,15,15),==,0xF,0xF,0xF));
33     PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),<,1,0,0));
34     PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),!=,1,0,0));
35     PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,<,1,0,0));
36     PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,>,0,0,0));
37 }
38 
main()39 int main()
40 {
41     test_BOOST_PREDEF_WORKAROUND();
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 }
63