From 927f98189d860cb954aadcd5bba57d29c480f191 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 1 Jun 2014 02:10:28 +0300 Subject: [PATCH] Update enable_if tests to use lightweight_test, add to Jamfile. --- test/Jamfile.v2 | 11 +++++++++++ test/eif_constructors.cpp | 17 ++++++++--------- test/eif_dummy_arg_disambiguation.cpp | 15 +++++++-------- test/eif_lazy.cpp | 11 +++++------ test/eif_lazy_test.cpp | 24 +++++++++++------------- test/eif_member_templates.cpp | 15 +++++++-------- test/eif_namespace_disambiguation.cpp | 14 +++++++------- test/eif_no_disambiguation.cpp | 14 +++++++------- test/eif_partial_specializations.cpp | 23 +++++++++++------------ 9 files changed, 74 insertions(+), 70 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ed6e7e4..74fd336 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -15,7 +15,18 @@ test-suite "core" [ run addressof_test2.cpp ] [ run addressof_np_test.cpp ] [ run addressof_fn_test.cpp ] + [ compile-fail checked_delete_fail.cpp ] + [ compile ref_ct_test.cpp ] [ run ref_test.cpp ] + + [ run eif_constructors.cpp ] + [ run eif_dummy_arg_disambiguation.cpp ] + [ run eif_lazy.cpp ] + [ run eif_lazy_test.cpp ] + [ run eif_member_templates.cpp ] + [ run eif_namespace_disambiguation.cpp ] + [ run eif_no_disambiguation.cpp ] + [ run eif_partial_specializations.cpp ] ; diff --git a/test/eif_constructors.cpp b/test/eif_constructors.cpp index 0d465de..ea82b40 100644 --- a/test/eif_constructors.cpp +++ b/test/eif_constructors.cpp @@ -10,10 +10,9 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include - #include #include +#include using boost::enable_if; using boost::disable_if; @@ -44,19 +43,19 @@ struct xstring }; -int test_main(int, char*[]) +int main() { - BOOST_CHECK(container(1).my_value); - BOOST_CHECK(container(1.0).my_value); + BOOST_TEST(container(1).my_value); + BOOST_TEST(container(1.0).my_value); - BOOST_CHECK(!container("1").my_value); - BOOST_CHECK(!container(static_cast(0)).my_value); + BOOST_TEST(!container("1").my_value); + BOOST_TEST(!container(static_cast(0)).my_value); char sa[] = "123456"; - BOOST_CHECK(xstring(sa, sa+6).data == 6); + BOOST_TEST(xstring(sa, sa+6).data == 6); - return 0; + return boost::report_errors(); } diff --git a/test/eif_dummy_arg_disambiguation.cpp b/test/eif_dummy_arg_disambiguation.cpp index 60dfdfd..e72b158 100644 --- a/test/eif_dummy_arg_disambiguation.cpp +++ b/test/eif_dummy_arg_disambiguation.cpp @@ -10,10 +10,9 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include - #include #include +#include using boost::enable_if; using boost::disable_if; @@ -32,15 +31,15 @@ typename disable_if, bool>::type arithmetic_object(T t, dummy<1> = 0) { return false; } -int test_main(int, char*[]) +int main() { - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); + BOOST_TEST(arithmetic_object(1)); + BOOST_TEST(arithmetic_object(1.0)); - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); + BOOST_TEST(!arithmetic_object("1")); + BOOST_TEST(!arithmetic_object(static_cast(0))); - return 0; + return boost::report_errors(); } diff --git a/test/eif_lazy.cpp b/test/eif_lazy.cpp index f04111e..029eca5 100644 --- a/test/eif_lazy.cpp +++ b/test/eif_lazy.cpp @@ -10,10 +10,9 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include - #include #include +#include using boost::enable_if_c; using boost::lazy_enable_if_c; @@ -69,14 +68,14 @@ mult(const T& x, const U& y) {return x * y;} double mult(int i, double d) { return (double)i * d; } -int test_main(int, char*[]) +int main() { - BOOST_CHECK(mult(1, 2) == 2); + BOOST_TEST(mult(1, 2) == 2); - BOOST_CHECK(mult(1, 3.0) == 3.0); + BOOST_TEST(mult(1, 3.0) == 3.0); - return 0; + return boost::report_errors(); } diff --git a/test/eif_lazy_test.cpp b/test/eif_lazy_test.cpp index 9ec5324..6077759 100644 --- a/test/eif_lazy_test.cpp +++ b/test/eif_lazy_test.cpp @@ -12,11 +12,9 @@ // Testing all variations of lazy_enable_if. -#include -#include - #include #include +#include using boost::lazy_enable_if; using boost::lazy_disable_if; @@ -79,22 +77,22 @@ namespace B { foo2(T t) { return false; } } -int test_main(int, char*[]) +int main() { using namespace A; using namespace B; - BOOST_CHECK(foo(1)); - BOOST_CHECK(foo(1.0)); + BOOST_TEST(foo(1)); + BOOST_TEST(foo(1.0)); - BOOST_CHECK(!foo("1")); - BOOST_CHECK(!foo(static_cast(0))); + BOOST_TEST(!foo("1")); + BOOST_TEST(!foo(static_cast(0))); - BOOST_CHECK(foo2(1)); - BOOST_CHECK(foo2(1.0)); + BOOST_TEST(foo2(1)); + BOOST_TEST(foo2(1.0)); - BOOST_CHECK(!foo2("1")); - BOOST_CHECK(!foo2(static_cast(0))); + BOOST_TEST(!foo2("1")); + BOOST_TEST(!foo2(static_cast(0))); - return 0; + return boost::report_errors(); } diff --git a/test/eif_member_templates.cpp b/test/eif_member_templates.cpp index 55e2d80..2f1eeb2 100644 --- a/test/eif_member_templates.cpp +++ b/test/eif_member_templates.cpp @@ -10,10 +10,9 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include - #include #include +#include using boost::enable_if; using boost::disable_if; @@ -29,15 +28,15 @@ struct container { arithmetic_object(const T&) {return false;} }; -int test_main(int, char*[]) +int main() { - BOOST_CHECK(container().arithmetic_object(1)); - BOOST_CHECK(container().arithmetic_object(1.0)); + BOOST_TEST(container().arithmetic_object(1)); + BOOST_TEST(container().arithmetic_object(1.0)); - BOOST_CHECK(!container().arithmetic_object("1")); - BOOST_CHECK(!container().arithmetic_object(static_cast(0))); + BOOST_TEST(!container().arithmetic_object("1")); + BOOST_TEST(!container().arithmetic_object(static_cast(0))); - return 0; + return boost::report_errors(); } diff --git a/test/eif_namespace_disambiguation.cpp b/test/eif_namespace_disambiguation.cpp index 45d4f0a..2a090cc 100644 --- a/test/eif_namespace_disambiguation.cpp +++ b/test/eif_namespace_disambiguation.cpp @@ -10,11 +10,11 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include #include #include #include +#include using boost::enable_if; using boost::mpl::not_; @@ -32,16 +32,16 @@ namespace B { arithmetic_object(T t) { return false; } } -int test_main(int, char*[]) +int main() { using namespace A; using namespace B; - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); + BOOST_TEST(arithmetic_object(1)); + BOOST_TEST(arithmetic_object(1.0)); - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); + BOOST_TEST(!arithmetic_object("1")); + BOOST_TEST(!arithmetic_object(static_cast(0))); - return 0; + return boost::report_errors(); } diff --git a/test/eif_no_disambiguation.cpp b/test/eif_no_disambiguation.cpp index e2416ed..d2ecbd9 100644 --- a/test/eif_no_disambiguation.cpp +++ b/test/eif_no_disambiguation.cpp @@ -10,11 +10,11 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include #include #include #include +#include using boost::mpl::not_; using boost::enable_if; @@ -29,15 +29,15 @@ typename enable_if >, bool>::type arithmetic_object(T t) { return false; } -int test_main(int, char*[]) +int main() { - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); + BOOST_TEST(arithmetic_object(1)); + BOOST_TEST(arithmetic_object(1.0)); - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); + BOOST_TEST(!arithmetic_object("1")); + BOOST_TEST(!arithmetic_object(static_cast(0))); - return 0; + return boost::report_errors(); } diff --git a/test/eif_partial_specializations.cpp b/test/eif_partial_specializations.cpp index 1d4db99..a023f53 100644 --- a/test/eif_partial_specializations.cpp +++ b/test/eif_partial_specializations.cpp @@ -10,10 +10,9 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) -#include - #include #include +#include using boost::enable_if_c; using boost::disable_if_c; @@ -47,21 +46,21 @@ struct tester2 >::type> { BOOST_STATIC_CONSTANT(bool, value = false); }; -int test_main(int, char*[]) +int main() { - BOOST_CHECK(tester::value); - BOOST_CHECK(tester::value); + BOOST_TEST(tester::value); + BOOST_TEST(tester::value); - BOOST_CHECK(!tester::value); - BOOST_CHECK(!tester::value); + BOOST_TEST(!tester::value); + BOOST_TEST(!tester::value); - BOOST_CHECK(tester2::value); - BOOST_CHECK(tester2::value); + BOOST_TEST(tester2::value); + BOOST_TEST(tester2::value); - BOOST_CHECK(!tester2::value); - BOOST_CHECK(!tester2::value); + BOOST_TEST(!tester2::value); + BOOST_TEST(!tester2::value); - return 0; + return boost::report_errors(); }