Update enable_if tests to use lightweight_test, add to Jamfile.

This commit is contained in:
Peter Dimov
2014-06-01 02:10:28 +03:00
parent ba9f0e47a1
commit 927f98189d
9 changed files with 74 additions and 70 deletions

View File

@@ -15,7 +15,18 @@ test-suite "core"
[ run addressof_test2.cpp ] [ run addressof_test2.cpp ]
[ run addressof_np_test.cpp ] [ run addressof_np_test.cpp ]
[ run addressof_fn_test.cpp ] [ run addressof_fn_test.cpp ]
[ compile-fail checked_delete_fail.cpp ] [ compile-fail checked_delete_fail.cpp ]
[ compile ref_ct_test.cpp ] [ compile ref_ct_test.cpp ]
[ run ref_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 ]
; ;

View File

@@ -10,10 +10,9 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if; using boost::enable_if;
using boost::disable_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_TEST(container(1).my_value);
BOOST_CHECK(container(1.0).my_value); BOOST_TEST(container(1.0).my_value);
BOOST_CHECK(!container("1").my_value); BOOST_TEST(!container("1").my_value);
BOOST_CHECK(!container(static_cast<void*>(0)).my_value); BOOST_TEST(!container(static_cast<void*>(0)).my_value);
char sa[] = "123456"; char sa[] = "123456";
BOOST_CHECK(xstring<char>(sa, sa+6).data == 6); BOOST_TEST(xstring<char>(sa, sa+6).data == 6);
return 0; return boost::report_errors();
} }

View File

@@ -10,10 +10,9 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_arithmetic.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if; using boost::enable_if;
using boost::disable_if; using boost::disable_if;
@@ -32,15 +31,15 @@ typename disable_if<is_arithmetic<T>, bool>::type
arithmetic_object(T t, dummy<1> = 0) { return false; } arithmetic_object(T t, dummy<1> = 0) { return false; }
int test_main(int, char*[]) int main()
{ {
BOOST_CHECK(arithmetic_object(1)); BOOST_TEST(arithmetic_object(1));
BOOST_CHECK(arithmetic_object(1.0)); BOOST_TEST(arithmetic_object(1.0));
BOOST_CHECK(!arithmetic_object("1")); BOOST_TEST(!arithmetic_object("1"));
BOOST_CHECK(!arithmetic_object(static_cast<void*>(0))); BOOST_TEST(!arithmetic_object(static_cast<void*>(0)));
return 0; return boost::report_errors();
} }

View File

@@ -10,10 +10,9 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if_c; using boost::enable_if_c;
using boost::lazy_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; } 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();
} }

View File

@@ -12,11 +12,9 @@
// Testing all variations of lazy_enable_if. // Testing all variations of lazy_enable_if.
#include <boost/test/minimal.hpp>
#include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::lazy_enable_if; using boost::lazy_enable_if;
using boost::lazy_disable_if; using boost::lazy_disable_if;
@@ -79,22 +77,22 @@ namespace B {
foo2(T t) { return false; } foo2(T t) { return false; }
} }
int test_main(int, char*[]) int main()
{ {
using namespace A; using namespace A;
using namespace B; using namespace B;
BOOST_CHECK(foo(1)); BOOST_TEST(foo(1));
BOOST_CHECK(foo(1.0)); BOOST_TEST(foo(1.0));
BOOST_CHECK(!foo("1")); BOOST_TEST(!foo("1"));
BOOST_CHECK(!foo(static_cast<void*>(0))); BOOST_TEST(!foo(static_cast<void*>(0)));
BOOST_CHECK(foo2(1)); BOOST_TEST(foo2(1));
BOOST_CHECK(foo2(1.0)); BOOST_TEST(foo2(1.0));
BOOST_CHECK(!foo2("1")); BOOST_TEST(!foo2("1"));
BOOST_CHECK(!foo2(static_cast<void*>(0))); BOOST_TEST(!foo2(static_cast<void*>(0)));
return 0; return boost::report_errors();
} }

View File

@@ -10,10 +10,9 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_arithmetic.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if; using boost::enable_if;
using boost::disable_if; using boost::disable_if;
@@ -29,15 +28,15 @@ struct container {
arithmetic_object(const T&) {return false;} arithmetic_object(const T&) {return false;}
}; };
int test_main(int, char*[]) int main()
{ {
BOOST_CHECK(container().arithmetic_object(1)); BOOST_TEST(container().arithmetic_object(1));
BOOST_CHECK(container().arithmetic_object(1.0)); BOOST_TEST(container().arithmetic_object(1.0));
BOOST_CHECK(!container().arithmetic_object("1")); BOOST_TEST(!container().arithmetic_object("1"));
BOOST_CHECK(!container().arithmetic_object(static_cast<void*>(0))); BOOST_TEST(!container().arithmetic_object(static_cast<void*>(0)));
return 0; return boost::report_errors();
} }

View File

@@ -10,11 +10,11 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_arithmetic.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if; using boost::enable_if;
using boost::mpl::not_; using boost::mpl::not_;
@@ -32,16 +32,16 @@ namespace B {
arithmetic_object(T t) { return false; } arithmetic_object(T t) { return false; }
} }
int test_main(int, char*[]) int main()
{ {
using namespace A; using namespace A;
using namespace B; using namespace B;
BOOST_CHECK(arithmetic_object(1)); BOOST_TEST(arithmetic_object(1));
BOOST_CHECK(arithmetic_object(1.0)); BOOST_TEST(arithmetic_object(1.0));
BOOST_CHECK(!arithmetic_object("1")); BOOST_TEST(!arithmetic_object("1"));
BOOST_CHECK(!arithmetic_object(static_cast<void*>(0))); BOOST_TEST(!arithmetic_object(static_cast<void*>(0)));
return 0; return boost::report_errors();
} }

View File

@@ -10,11 +10,11 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_arithmetic.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::mpl::not_; using boost::mpl::not_;
using boost::enable_if; using boost::enable_if;
@@ -29,15 +29,15 @@ typename enable_if<not_<is_arithmetic<T> >, bool>::type
arithmetic_object(T t) { return false; } arithmetic_object(T t) { return false; }
int test_main(int, char*[]) int main()
{ {
BOOST_CHECK(arithmetic_object(1)); BOOST_TEST(arithmetic_object(1));
BOOST_CHECK(arithmetic_object(1.0)); BOOST_TEST(arithmetic_object(1.0));
BOOST_CHECK(!arithmetic_object("1")); BOOST_TEST(!arithmetic_object("1"));
BOOST_CHECK(!arithmetic_object(static_cast<void*>(0))); BOOST_TEST(!arithmetic_object(static_cast<void*>(0)));
return 0; return boost::report_errors();
} }

View File

@@ -10,10 +10,9 @@
// Jeremiah Willcock (jewillco at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu)
#include <boost/test/minimal.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_arithmetic.hpp>
#include <boost/detail/lightweight_test.hpp>
using boost::enable_if_c; using boost::enable_if_c;
using boost::disable_if_c; using boost::disable_if_c;
@@ -47,21 +46,21 @@ struct tester2<T, typename disable_if<is_arithmetic<T> >::type> {
BOOST_STATIC_CONSTANT(bool, value = false); BOOST_STATIC_CONSTANT(bool, value = false);
}; };
int test_main(int, char*[]) int main()
{ {
BOOST_CHECK(tester<int>::value); BOOST_TEST(tester<int>::value);
BOOST_CHECK(tester<double>::value); BOOST_TEST(tester<double>::value);
BOOST_CHECK(!tester<char*>::value); BOOST_TEST(!tester<char*>::value);
BOOST_CHECK(!tester<void*>::value); BOOST_TEST(!tester<void*>::value);
BOOST_CHECK(tester2<int>::value); BOOST_TEST(tester2<int>::value);
BOOST_CHECK(tester2<double>::value); BOOST_TEST(tester2<double>::value);
BOOST_CHECK(!tester2<char*>::value); BOOST_TEST(!tester2<char*>::value);
BOOST_CHECK(!tester2<void*>::value); BOOST_TEST(!tester2<void*>::value);
return 0; return boost::report_errors();
} }