forked from boostorg/type_traits
Bring type traits into line with TR1
[SVN r26937]
This commit is contained in:
1 parent
07c3946e77
commit
119a76547b
27 files changed
+1284
-61
No files matched your search
Executable
+43
@@ -0,0 +1,43 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/extent.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(extent)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[5][10]>::value, 5);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int[5][10][40]>::value, 5);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int (&)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::extent<int (*)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int,1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[][10],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],1>::value), 10);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int (&)[5][10],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int (*)[5][10],1>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10],2>::value), 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],2>::value), 40);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::extent<int[5][10][40],3>::value), 0);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/has_virtual_destructor.hpp>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
TT_TEST_BEGIN(has_virtual_destructor)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<const int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<volatile int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int* const>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int[2]>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<mf4>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<f1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<enum_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<empty_UDT>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<UDT*>::value, false);
|
||||
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_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);
|
||||
#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);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_base_of.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
TT_TEST_BEGIN(is_base_of)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,Derived>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Derived2,MultiBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,PrivateBase>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<NonDerived,Base>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,void>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<Base,const void>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<void,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const void,Derived>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<int, int>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<const int, int>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VB,VD>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<VD,VB>::value), false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<test_abc1,test_abc3>::value), true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of<test_abc3,test_abc1>::value), false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_floating_point.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_floating_point)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<double const volatile>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double const>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double volatile>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<long double const volatile>::value, true);
|
||||
|
||||
//
|
||||
// cases that should not be true:
|
||||
//
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<void>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<empty_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const float&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float[2]>::value, false);
|
||||
|
||||
//
|
||||
// tricky cases:
|
||||
//
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo0_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo1_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo2_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo3_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<foo4_t>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<incomplete_type>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_member_object_pointer.hpp>
|
||||
#endif
|
||||
|
||||
typedef const double (UDT::*mp2) ;
|
||||
|
||||
TT_TEST_BEGIN(is_member_object_pointer)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f2>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<f3>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<void*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf2>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf3>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mf4>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<cmf>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mp>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<mp2>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<void>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<incomplete_type>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_object_pointer<foo0_t>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_signed.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_signed)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<signed char>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned long>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned short>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<unsigned char>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_signed<int[2]>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/is_unsigned.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(is_signed)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<long>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<short>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<signed char>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned int>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned long>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned short>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<unsigned char>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int&>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int*>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_unsigned<int[2]>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_integral_constant.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/rank.hpp>
|
||||
#endif
|
||||
|
||||
TT_TEST_BEGIN(rank)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[]>::value, 1);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[][10]>::value, 2);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[5][10]>::value, 2);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int[5][10][40]>::value, 3);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int (&)[5][10]>::value, 0);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::rank<int (*)[5][10]>::value, 0);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/remove_all_extents.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_1, ::boost::remove_all_extents, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_2, ::boost::remove_all_extents, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_all_extents_test_3, ::boost::remove_all_extents, [2])
|
||||
BOOST_DECL_TRANSFORM_TEST0(remove_all_extents_test_4, ::boost::remove_all_extents)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_5, ::boost::remove_all_extents, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_6, ::boost::remove_all_extents, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_7, ::boost::remove_all_extents, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_8, ::boost::remove_all_extents, const [2], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_9, ::boost::remove_all_extents, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_10, ::boost::remove_all_extents, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_11, ::boost::remove_all_extents, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_12, ::boost::remove_all_extents, const[2][3], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_13, ::boost::remove_all_extents, (&)[2], (&)[2])
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_all_extents_test_14, ::boost::remove_all_extents, [])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_15, ::boost::remove_all_extents, const [], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_all_extents_test_16, ::boost::remove_all_extents, const[][3], const)
|
||||
|
||||
TT_TEST_BEGIN(remove_all_extents)
|
||||
|
||||
remove_all_extents_test_1();
|
||||
remove_all_extents_test_2();
|
||||
remove_all_extents_test_3();
|
||||
remove_all_extents_test_4();
|
||||
remove_all_extents_test_5();
|
||||
remove_all_extents_test_6();
|
||||
remove_all_extents_test_7();
|
||||
remove_all_extents_test_8();
|
||||
remove_all_extents_test_9();
|
||||
remove_all_extents_test_10();
|
||||
remove_all_extents_test_11();
|
||||
remove_all_extents_test_12();
|
||||
remove_all_extents_test_13();
|
||||
remove_all_extents_test_14();
|
||||
remove_all_extents_test_15();
|
||||
remove_all_extents_test_16();
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to 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 "test.hpp"
|
||||
#include "check_type.hpp"
|
||||
#ifdef TEST_STD
|
||||
# include <type_traits>
|
||||
#else
|
||||
# include <boost/type_traits/remove_extent.hpp>
|
||||
#endif
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_1, ::boost::remove_extent, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_2, ::boost::remove_extent, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_extent_test_3, ::boost::remove_extent, [2])
|
||||
BOOST_DECL_TRANSFORM_TEST0(remove_extent_test_4, ::boost::remove_extent)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_5, ::boost::remove_extent, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_6, ::boost::remove_extent, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_7, ::boost::remove_extent, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_8, ::boost::remove_extent, const [2], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_9, ::boost::remove_extent, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_10, ::boost::remove_extent, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_11, ::boost::remove_extent, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_12, ::boost::remove_extent, const[2][3], const[3])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_13, ::boost::remove_extent, (&)[2], (&)[2])
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_extent_test_14, ::boost::remove_extent, [])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_15, ::boost::remove_extent, const [], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_extent_test_16, ::boost::remove_extent, const[][3], const[3])
|
||||
|
||||
TT_TEST_BEGIN(remove_extent)
|
||||
|
||||
remove_extent_test_1();
|
||||
remove_extent_test_2();
|
||||
remove_extent_test_3();
|
||||
remove_extent_test_4();
|
||||
remove_extent_test_5();
|
||||
remove_extent_test_6();
|
||||
remove_extent_test_7();
|
||||
remove_extent_test_8();
|
||||
remove_extent_test_9();
|
||||
remove_extent_test_10();
|
||||
remove_extent_test_11();
|
||||
remove_extent_test_12();
|
||||
remove_extent_test_13();
|
||||
remove_extent_test_14();
|
||||
remove_extent_test_15();
|
||||
remove_extent_test_16();
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ struct convertible_to_anything
|
||||
TT_TEST_BEGIN(is_enum)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<convertible_to_anything>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_enum<int[] >::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
Reference in new issue
Block a user