summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/predef/test/workaround.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/predef/test/workaround.cpp')
-rw-r--r--src/boost/libs/predef/test/workaround.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/boost/libs/predef/test/workaround.cpp b/src/boost/libs/predef/test/workaround.cpp
new file mode 100644
index 000000000..368daea3a
--- /dev/null
+++ b/src/boost/libs/predef/test/workaround.cpp
@@ -0,0 +1,62 @@
+/*
+Copyright Rene Rivera 2011-2017
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include <boost/predef/version_number.h>
+#include <boost/predef/other/workaround.h>
+#include <exception>
+#include <vector>
+#include <string>
+#include <iostream>
+
+namespace
+{
+ struct test_info
+ {
+ std::string value;
+ bool passed;
+
+ test_info(std::string const & v, bool p) : value(v), passed(p) {}
+ test_info(test_info const & o) : value(o.value), passed(o.passed) {}
+ };
+
+ std::vector<test_info> test_results;
+}
+
+#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X)))
+
+void test_BOOST_PREDEF_WORKAROUND()
+{
+ PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(15,15,15),==,0xF,0xF,0xF));
+ PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),<,1,0,0));
+ PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER(0,9,0),!=,1,0,0));
+ PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,<,1,0,0));
+ PREDEF_CHECK(BOOST_PREDEF_WORKAROUND(BOOST_VERSION_NUMBER_MIN,>,0,0,0));
+}
+
+int main()
+{
+ test_BOOST_PREDEF_WORKAROUND();
+
+ unsigned fail_count = 0;
+ std::vector<test_info>::iterator i = test_results.begin();
+ std::vector<test_info>::iterator e = test_results.end();
+ for (; i != e; ++i)
+ {
+ std::cout
+ << (i->passed ? "[passed]" : "[failed]")
+ << " " << i->value
+ << std::endl;
+ fail_count += i->passed ? 0 : 1;
+ }
+ std::cout
+ << std::endl
+ << "TOTAL: "
+ << "passed " << (test_results.size()-fail_count) << ", "
+ << "failed " << (fail_count) << ", "
+ << "of " << (test_results.size())
+ << std::endl;
+ return fail_count;
+}