Slightly more robust test cases rule out some wrongheaded implementation ideas

[SVN r12617]
This commit is contained in:
Dave Abrahams
2002-02-01 04:35:47 +00:00
parent 6ce582379a
commit 7504f83ee0

View File

@ -9,6 +9,11 @@
#include <boost/test/cpp_main.cpp>
#include "boost/type_traits/type_traits_test.hpp"
template <class T>
struct convertible_from
{
convertible_from(T);
};
int cpp_main(int argc, char* argv[])
{
@ -20,6 +25,25 @@ int cpp_main(int argc, char* argv[])
value_test(false, (boost::is_convertible<NonDerived,Base>::value));
value_test(false, (boost::is_convertible<boost::noncopyable, int>::value));
value_test(true, (boost::is_convertible<float,int>::value));
value_test(true, (boost::is_convertible<float,convertible_from<float> >::value));
value_test(true, (boost::is_convertible<float,convertible_from<float const&> >::value));
value_test(true, (boost::is_convertible<float,convertible_from<float&> >::value));
value_test(true, (boost::is_convertible<float,convertible_from<char> >::value));
value_test(true, (boost::is_convertible<float,convertible_from<char const&> >::value));
value_test(false, (boost::is_convertible<float,convertible_from<char&> >::value));
value_test(true, (boost::is_convertible<char,convertible_from<char> >::value));
value_test(true, (boost::is_convertible<char,convertible_from<char const&> >::value));
value_test(true, (boost::is_convertible<char,convertible_from<char&> >::value));
value_test(true, (boost::is_convertible<float&,convertible_from<float> >::value));
value_test(true, (boost::is_convertible<float const&,convertible_from<float> >::value));
value_test(true, (boost::is_convertible<float&,convertible_from<float&> >::value));
value_test(true, (boost::is_convertible<float const&,convertible_from<float const&> >::value));
value_test(true, (boost::is_convertible<float&,convertible_from<float const&> >::value));
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
value_test(false, (boost::is_convertible<float,void>::value));
value_test(false, (boost::is_convertible<void,float>::value));