forked from boostorg/type_traits
Added warning for "desirable" results that don't come true.
Cleaned up test types: they should be either "all-trivial" or "all-non-trivial". Added new test cases for has_nothrow* traits. Fixed test cases for has_virtual_destructor. [SVN r28662]
This commit is contained in:
@ -62,7 +62,7 @@ namespace boost{
|
||||
if(!::boost::detail::tt_compare((int)expression, alternate_value))\
|
||||
BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression) << "\" had an invalid value (found " << ::boost::detail::integral_constant<(int)(expression)>::value() << ", expected " << expected_value << ")" );\
|
||||
else\
|
||||
BOOST_WARN_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression) << "\" did not have the value we wish it to have (found " << ::boost::detail::integral_constant<(int)(expression)>::value() << ", expected " << expected_value << ")" )
|
||||
BOOST_WARN_MESSAGE(false, "<note>The expression: \"" << BOOST_STRINGIZE(expression) << "\" did not have the value we wish it to have (found " << ::boost::detail::integral_constant<(int)(expression)>::value() << ", expected " << expected_value << ")</note>" )
|
||||
|
||||
|
||||
}//detail
|
||||
|
@ -154,6 +154,9 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_POD_UDT>::valu
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_assign_UDT>::value, true, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_copy_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<nothrow_construct_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<test_abc1>::value, false);
|
||||
|
||||
|
@ -154,6 +154,9 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_POD_UDT>:
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_construct_UDT>::value, true, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_assign_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<nothrow_copy_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<test_abc1>::value, false);
|
||||
|
||||
|
@ -149,11 +149,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2][4][5][6][3]>::value,
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void>::value, true);
|
||||
// cases we would like to succeed but can't implement in the language:
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_POD_union_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_copy_UDT>::value, true, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_assign_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<nothrow_construct_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<test_abc1>::value, false);
|
||||
|
||||
|
@ -149,7 +149,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2][4][5][6][3]>::value,
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<void>::value, true);
|
||||
// cases we would like to succeed but can't implement in the language:
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<empty_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<empty_POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<POD_UDT>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<POD_union_UDT>::value, true, false);
|
||||
|
@ -36,25 +36,22 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT[2]>::value, false
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<void>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VB>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VD>::value, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VB>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<VD>::value, true, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<test_abc2>::value, false);
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::iostream>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_ios<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_istream<char> >::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, false);
|
||||
// some libraries don't make this one a polymorphic class, since this is a library
|
||||
// rather than a type traits issue we won't test this for now...
|
||||
//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::ios_base>::value, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::iostream>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_ios<char> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_istream<char> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::basic_streambuf<char> >::value, true, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::exception>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::runtime_error>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::out_of_range>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::range_error>::value, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::exception>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::runtime_error>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::out_of_range>::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::range_error>::value, true, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
@ -55,7 +55,7 @@ class unit_initialiser
|
||||
public:
|
||||
unit_initialiser(void (*f)(), const char* name)
|
||||
{
|
||||
get_master_unit("Type Traits")->add( ::boost::unit_test_framework::create_test_case(f, name) );
|
||||
get_master_unit("Type Traits")->add( BOOST_TEST_CASE(f) );
|
||||
}
|
||||
};
|
||||
|
||||
@ -201,6 +201,8 @@ typedef const r_type cr_type;
|
||||
struct POD_UDT { int x; };
|
||||
struct empty_UDT
|
||||
{
|
||||
empty_UDT(){};
|
||||
empty_UDT(const empty_UDT&){};
|
||||
~empty_UDT(){};
|
||||
empty_UDT& operator=(const empty_UDT&){ return *this; }
|
||||
bool operator==(const empty_UDT&)const
|
||||
@ -208,7 +210,6 @@ struct empty_UDT
|
||||
};
|
||||
struct empty_POD_UDT
|
||||
{
|
||||
empty_POD_UDT& operator=(const empty_POD_UDT&){ return *this; }
|
||||
bool operator==(const empty_POD_UDT&)const
|
||||
{ return true; }
|
||||
};
|
||||
@ -229,6 +230,36 @@ union empty_union_UDT
|
||||
};
|
||||
union empty_POD_union_UDT{};
|
||||
|
||||
struct nothrow_copy_UDT
|
||||
{
|
||||
nothrow_copy_UDT();
|
||||
nothrow_copy_UDT(const nothrow_copy_UDT&)throw();
|
||||
~nothrow_copy_UDT(){};
|
||||
nothrow_copy_UDT& operator=(const nothrow_copy_UDT&){ return *this; }
|
||||
bool operator==(const nothrow_copy_UDT&)const
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
struct nothrow_assign_UDT
|
||||
{
|
||||
nothrow_assign_UDT();
|
||||
nothrow_assign_UDT(const nothrow_assign_UDT&);
|
||||
~nothrow_assign_UDT(){};
|
||||
nothrow_assign_UDT& operator=(const nothrow_assign_UDT&)throw(){ return *this; }
|
||||
bool operator==(const nothrow_assign_UDT&)const
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
struct nothrow_construct_UDT
|
||||
{
|
||||
nothrow_construct_UDT()throw();
|
||||
nothrow_construct_UDT(const nothrow_construct_UDT&);
|
||||
~nothrow_construct_UDT(){};
|
||||
nothrow_construct_UDT& operator=(const nothrow_construct_UDT&){ return *this; }
|
||||
bool operator==(const nothrow_construct_UDT&)const
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
class Base { };
|
||||
|
||||
class Derived : public Base { };
|
||||
@ -292,6 +323,9 @@ struct non_empty : private boost::noncopyable
|
||||
// abstract base classes:
|
||||
struct test_abc1
|
||||
{
|
||||
test_abc1();
|
||||
test_abc1(const test_abc1&);
|
||||
test_abc1& operator=(const test_abc1&);
|
||||
virtual void foo() = 0;
|
||||
virtual void foo2() = 0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user