forked from boostorg/type_traits
Added new type traits files.
[SVN r9238]
This commit is contained in:
1 parent
6fda1821b2
commit
f3976d8060
32 files changed
+6095
-24
No files matched your search
@@ -0,0 +1,44 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/alignment_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(alignment_of)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(alignment_of, int)
|
||||
NESTED_TEST(alignment_of, int_constructible)
|
||||
|
||||
align_test(int);
|
||||
align_test(char);
|
||||
align_test(double);
|
||||
align_test(int[4]);
|
||||
align_test(int(*)(int));
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
align_test(char&);
|
||||
align_test(char (&)(int));
|
||||
align_test(char(&)[4]);
|
||||
#endif
|
||||
align_test(int*);
|
||||
//align_test(const int);
|
||||
align_test(VB);
|
||||
align_test(VD);
|
||||
value_test(0, ::boost::alignment_of<void>::value);
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
unsigned int expected_failures = 0;
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_void)
|
||||
NESTED_DECL(is_integral)
|
||||
NESTED_DECL(is_float)
|
||||
NESTED_DECL(is_arithmetic)
|
||||
NESTED_DECL(is_fundamental)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_void, void)
|
||||
NESTED_TEST(is_void, int)
|
||||
NESTED_TEST(is_integral, int)
|
||||
NESTED_TEST(is_integral, float)
|
||||
NESTED_TEST(is_float, void)
|
||||
NESTED_TEST(is_float, double)
|
||||
NESTED_TEST(is_arithmetic, void)
|
||||
NESTED_TEST(is_arithmetic, int)
|
||||
NESTED_TEST(is_fundamental, UDT)
|
||||
NESTED_TEST(is_fundamental, int)
|
||||
|
||||
value_test(true, boost::is_void<void>::value)
|
||||
value_test(true, boost::is_void<const void>::value)
|
||||
value_test(true, boost::is_void<volatile void>::value)
|
||||
value_test(true, boost::is_void<const volatile void>::value)
|
||||
value_test(false, boost::is_void<int>::value)
|
||||
|
||||
value_test(false, boost::is_integral<UDT>::value)
|
||||
value_test(false, boost::is_integral<void>::value)
|
||||
value_test(true, boost::is_integral<bool>::value)
|
||||
value_test(true, boost::is_integral<char>::value)
|
||||
value_test(true, boost::is_integral<signed char>::value)
|
||||
value_test(true, boost::is_integral<unsigned char>::value)
|
||||
value_test(true, boost::is_integral<wchar_t>::value)
|
||||
value_test(true, boost::is_integral<short>::value)
|
||||
value_test(true, boost::is_integral<unsigned short>::value)
|
||||
value_test(true, boost::is_integral<int>::value)
|
||||
value_test(true, boost::is_integral<unsigned int>::value)
|
||||
value_test(true, boost::is_integral<long>::value)
|
||||
value_test(true, boost::is_integral<unsigned long>::value)
|
||||
value_test(false, boost::is_integral<float>::value)
|
||||
value_test(false, boost::is_integral<double>::value)
|
||||
value_test(false, boost::is_integral<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<long long>::value)
|
||||
value_test(true, boost::is_integral<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<__int64>::value)
|
||||
value_test(true, boost::is_integral<unsigned __int64>::value)
|
||||
#endif
|
||||
//const qualified ints:
|
||||
value_test(true, boost::is_integral<const bool>::value)
|
||||
value_test(true, boost::is_integral<const char>::value)
|
||||
value_test(true, boost::is_integral<const signed char>::value)
|
||||
value_test(true, boost::is_integral<const unsigned char>::value)
|
||||
value_test(true, boost::is_integral<const wchar_t>::value)
|
||||
value_test(true, boost::is_integral<const short>::value)
|
||||
value_test(true, boost::is_integral<const unsigned short>::value)
|
||||
value_test(true, boost::is_integral<const int>::value)
|
||||
value_test(true, boost::is_integral<const unsigned int>::value)
|
||||
value_test(true, boost::is_integral<const long>::value)
|
||||
value_test(true, boost::is_integral<const unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<const long long>::value)
|
||||
value_test(true, boost::is_integral<const unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<const __int64>::value)
|
||||
value_test(true, boost::is_integral<const unsigned __int64>::value)
|
||||
#endif
|
||||
// volatile qualified ints:
|
||||
value_test(true, boost::is_integral<volatile bool>::value)
|
||||
value_test(true, boost::is_integral<volatile char>::value)
|
||||
value_test(true, boost::is_integral<volatile signed char>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned char>::value)
|
||||
value_test(true, boost::is_integral<volatile wchar_t>::value)
|
||||
value_test(true, boost::is_integral<volatile short>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned short>::value)
|
||||
value_test(true, boost::is_integral<volatile int>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned int>::value)
|
||||
value_test(true, boost::is_integral<volatile long>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<volatile long long>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<volatile __int64>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned __int64>::value)
|
||||
#endif
|
||||
//const qualified ints:
|
||||
value_test(true, boost::is_integral<const volatile bool>::value)
|
||||
value_test(true, boost::is_integral<const volatile char>::value)
|
||||
value_test(true, boost::is_integral<const volatile signed char>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned char>::value)
|
||||
value_test(true, boost::is_integral<const volatile wchar_t>::value)
|
||||
value_test(true, boost::is_integral<const volatile short>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned short>::value)
|
||||
value_test(true, boost::is_integral<const volatile int>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned int>::value)
|
||||
value_test(true, boost::is_integral<const volatile long>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<const volatile long long>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<const volatile __int64>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned __int64>::value)
|
||||
#endif
|
||||
value_test(true, boost::is_float<const volatile float>::value)
|
||||
value_test(true, boost::is_float<const volatile double>::value)
|
||||
value_test(true, boost::is_float<const volatile long double>::value)
|
||||
value_test(true, boost::is_float<volatile float>::value)
|
||||
value_test(true, boost::is_float<volatile double>::value)
|
||||
value_test(true, boost::is_float<volatile long double>::value)
|
||||
value_test(true, boost::is_float<const float>::value)
|
||||
value_test(true, boost::is_float<const double>::value)
|
||||
value_test(true, boost::is_float<const long double>::value)
|
||||
value_test(true, boost::is_float<float>::value)
|
||||
value_test(true, boost::is_float<double>::value)
|
||||
value_test(true, boost::is_float<long double>::value)
|
||||
value_test(false, boost::is_float<int>::value)
|
||||
value_test(false, boost::is_float<void>::value)
|
||||
value_test(false, boost::is_float<UDT>::value)
|
||||
|
||||
|
||||
value_test(false, boost::is_arithmetic<UDT>::value)
|
||||
value_test(false, boost::is_arithmetic<void>::value)
|
||||
value_test(true, boost::is_arithmetic<bool>::value)
|
||||
value_test(true, boost::is_arithmetic<char>::value)
|
||||
value_test(true, boost::is_arithmetic<signed char>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned char>::value)
|
||||
value_test(true, boost::is_arithmetic<wchar_t>::value)
|
||||
value_test(true, boost::is_arithmetic<short>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned short>::value)
|
||||
value_test(true, boost::is_arithmetic<int>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned int>::value)
|
||||
value_test(true, boost::is_arithmetic<long>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned long>::value)
|
||||
value_test(true, boost::is_arithmetic<float>::value)
|
||||
value_test(true, boost::is_arithmetic<double>::value)
|
||||
value_test(true, boost::is_arithmetic<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_arithmetic<long long>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_arithmetic<__int64>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned __int64>::value)
|
||||
#endif
|
||||
|
||||
value_test(false, boost::is_fundamental<UDT>::value)
|
||||
value_test(true, boost::is_fundamental<void>::value)
|
||||
value_test(true, boost::is_fundamental<bool>::value)
|
||||
value_test(true, boost::is_fundamental<char>::value)
|
||||
value_test(true, boost::is_fundamental<signed char>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned char>::value)
|
||||
value_test(true, boost::is_fundamental<wchar_t>::value)
|
||||
value_test(true, boost::is_fundamental<short>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned short>::value)
|
||||
value_test(true, boost::is_fundamental<int>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned int>::value)
|
||||
value_test(true, boost::is_fundamental<long>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned long>::value)
|
||||
value_test(true, boost::is_fundamental<float>::value)
|
||||
value_test(true, boost::is_fundamental<double>::value)
|
||||
value_test(true, boost::is_fundamental<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_fundamental<long long>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_fundamental<__int64>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned __int64>::value)
|
||||
#endif
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
unsigned int expected_failures = 0;
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_array)
|
||||
NESTED_DECL(is_pointer)
|
||||
NESTED_DECL(is_reference)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_array, int)
|
||||
NESTED_TEST(is_array, int[2])
|
||||
NESTED_TEST(is_array, int[3][4])
|
||||
NESTED_TEST(is_array, int const [5])
|
||||
NESTED_TEST(is_array, int(&)[2])
|
||||
NESTED_TEST(is_array, int (*)(double))
|
||||
NESTED_TEST(is_pointer, int)
|
||||
NESTED_TEST(is_pointer, int*)
|
||||
NESTED_TEST(is_reference, int)
|
||||
NESTED_TEST(is_reference, int&)
|
||||
|
||||
value_test(false, boost::is_array<int>::value)
|
||||
value_test(false, boost::is_array<int*>::value)
|
||||
value_test(false, boost::is_array<const int*>::value)
|
||||
value_test(false, boost::is_array<const volatile int*>::value)
|
||||
value_test(false, boost::is_array<int*const>::value)
|
||||
value_test(false, boost::is_array<const int*volatile>::value)
|
||||
value_test(false, boost::is_array<const volatile int*const>::value)
|
||||
value_test(true, boost::is_array<int[2]>::value)
|
||||
value_test(true, boost::is_array<const int[2]>::value)
|
||||
value_test(true, boost::is_array<const volatile int[2]>::value)
|
||||
value_test(true, boost::is_array<int[2][3]>::value)
|
||||
value_test(true, boost::is_array<UDT[2]>::value)
|
||||
value_test(false, boost::is_array<int(&)[2]>::value)
|
||||
value_test(false, boost::is_array<f1>::value)
|
||||
value_test(false, boost::is_array<void>::value)
|
||||
|
||||
value_test(false, boost::is_pointer<int>::value)
|
||||
value_test(false, boost::is_pointer<int&>::value)
|
||||
value_test(true, boost::is_pointer<int*>::value)
|
||||
value_test(true, boost::is_pointer<const int*>::value)
|
||||
value_test(true, boost::is_pointer<volatile int*>::value)
|
||||
value_test(true, boost::is_pointer<non_pointer*>::value)
|
||||
// these were false in previous versions (JM 20 Dec 2000):
|
||||
value_test(true, boost::is_pointer<int*const>::value)
|
||||
value_test(true, boost::is_pointer<int*volatile>::value)
|
||||
value_test(true, boost::is_pointer<int*const volatile>::value)
|
||||
// JM 02 Oct 2000:
|
||||
value_test(false, boost::is_pointer<non_pointer>::value)
|
||||
value_test(false, boost::is_pointer<int*&>::value)
|
||||
value_test(false, boost::is_pointer<int(&)[2]>::value)
|
||||
value_test(false, boost::is_pointer<int[2]>::value)
|
||||
value_test(false, boost::is_pointer<char[sizeof(void*)]>::value)
|
||||
value_test(false, boost::is_pointer<void>::value)
|
||||
|
||||
value_test(true, boost::is_pointer<f1>::value)
|
||||
value_test(true, boost::is_pointer<f2>::value)
|
||||
value_test(true, boost::is_pointer<f3>::value)
|
||||
// Steve: was 'true', should be 'false', via 3.9.2p3
|
||||
value_test(false, boost::is_pointer<mf1>::value)
|
||||
value_test(false, boost::is_pointer<mf2>::value)
|
||||
value_test(false, boost::is_pointer<mf3>::value)
|
||||
value_test(false, boost::is_pointer<mf4>::value)
|
||||
|
||||
value_test(false, boost::is_reference<bool>::value)
|
||||
value_test(true, boost::is_reference<int&>::value)
|
||||
value_test(true, boost::is_reference<const int&>::value)
|
||||
value_test(true, boost::is_reference<volatile int &>::value)
|
||||
value_test(true, boost::is_reference<const volatile int &>::value)
|
||||
value_test(true, boost::is_reference<r_type>::value)
|
||||
value_test(true, boost::is_reference<cr_type>::value)
|
||||
value_test(true, boost::is_reference<const UDT&>::value)
|
||||
value_test(false, boost::is_reference<void>::value)
|
||||
|
||||
value_test(false, boost::is_member_pointer<f1>::value)
|
||||
value_test(false, boost::is_member_pointer<f2>::value)
|
||||
value_test(false, boost::is_member_pointer<f3>::value)
|
||||
value_test(false, boost::is_member_pointer<void*>::value)
|
||||
value_test(true, boost::is_member_pointer<mf1>::value)
|
||||
value_test(true, boost::is_member_pointer<mf2>::value)
|
||||
value_test(true, boost::is_member_pointer<mf3>::value)
|
||||
value_test(true, boost::is_member_pointer<mf4>::value)
|
||||
value_test(false, boost::is_member_pointer<void>::value)
|
||||
|
||||
value_test(false, boost::is_enum<int>::value)
|
||||
value_test(true, boost::is_enum<enum_UDT>::value)
|
||||
value_test(false, boost::is_enum<int_convertible>::value)
|
||||
value_test(false, boost::is_enum<int&>::value)
|
||||
value_test(false, boost::is_enum<void>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
unsigned int expected_failures = 2;
|
||||
#elif defined(__GNUC__)
|
||||
unsigned int expected_failures = 1; // can't handle cv-qualified references
|
||||
#elif defined(BOOST_MSVC)
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_const)
|
||||
NESTED_DECL(is_volatile)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_const, int)
|
||||
NESTED_TEST(is_const, const int)
|
||||
NESTED_TEST(is_const, volatile int)
|
||||
NESTED_TEST(is_volatile, int)
|
||||
NESTED_TEST(is_volatile, const int)
|
||||
NESTED_TEST(is_volatile, volatile int)
|
||||
|
||||
value_test(false, boost::is_const<void>::value)
|
||||
value_test(true, boost::is_const<const void>::value)
|
||||
value_test(false, boost::is_const<int>::value)
|
||||
value_test(true, boost::is_const<const int>::value)
|
||||
value_test(true, boost::is_const<const UDT>::value)
|
||||
value_test(true, boost::is_const<const volatile UDT>::value)
|
||||
value_test(false, boost::is_volatile<void>::value)
|
||||
value_test(true, boost::is_volatile<volatile void>::value)
|
||||
value_test(false, boost::is_volatile<int>::value)
|
||||
value_test(true, boost::is_volatile<volatile int>::value)
|
||||
value_test(true, boost::is_volatile<volatile UDT>::value)
|
||||
value_test(true, boost::is_volatile<volatile UDT>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef BOOST_MSVC
|
||||
unsigned int expected_failures = 2;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
value_test(true, (boost::is_convertible<Deriverd,Base>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd,Deriverd>::value));
|
||||
value_test(true, (boost::is_convertible<Base,Base>::value));
|
||||
value_test(false, (boost::is_convertible<Base,Deriverd>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd,Deriverd>::value));
|
||||
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));
|
||||
#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));
|
||||
value_test(true, (boost::is_convertible<void,void>::value));
|
||||
#endif
|
||||
value_test(true, (boost::is_convertible<enum1, int>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd*, Base*>::value));
|
||||
value_test(false, (boost::is_convertible<Base*, Deriverd*>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd&, Base&>::value));
|
||||
value_test(false, (boost::is_convertible<Base&, Deriverd&>::value));
|
||||
value_test(true, (boost::is_convertible<const Deriverd*, const Base*>::value));
|
||||
value_test(false, (boost::is_convertible<const Base*, const Deriverd*>::value));
|
||||
value_test(true, (boost::is_convertible<const Deriverd&, const Base&>::value));
|
||||
value_test(false, (boost::is_convertible<const Base&, const Deriverd&>::value));
|
||||
|
||||
value_test(false, (boost::is_convertible<const int *, int*>::value));
|
||||
value_test(false, (boost::is_convertible<const int&, int&>::value));
|
||||
value_test(true, (boost::is_convertible<int*, int[2]>::value));
|
||||
value_test(false, (boost::is_convertible<const int*, int[3]>::value));
|
||||
value_test(true, (boost::is_convertible<const int&, int>::value));
|
||||
value_test(true, (boost::is_convertible<int(&)[4], const int*>::value));
|
||||
value_test(true, (boost::is_convertible<int(&)(int), int(*)(int)>::value));
|
||||
value_test(true, (boost::is_convertible<int *, const int*>::value));
|
||||
value_test(true, (boost::is_convertible<int&, const int&>::value));
|
||||
value_test(true, (boost::is_convertible<int[2], int*>::value));
|
||||
value_test(true, (boost::is_convertible<int[2], const int*>::value));
|
||||
value_test(false, (boost::is_convertible<const int[2], int*>::value));
|
||||
|
||||
value_test(true, (boost::is_convertible<non_pointer, void*>::value));
|
||||
value_test(false, (boost::is_convertible<non_pointer, int*>::value));
|
||||
value_test(true, (boost::is_convertible<non_int_pointer, int*>::value));
|
||||
value_test(true, (boost::is_convertible<non_int_pointer, void*>::value));
|
||||
value_test(true, (boost::is_convertible<int, int_constructible>::value));
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
value_test(true, (::boost::is_same<int, int>::value))
|
||||
value_test(false, (::boost::is_same<int, const int>::value))
|
||||
value_test(false, (::boost::is_same<int, int&>::value))
|
||||
value_test(false, (::boost::is_same<const int, int&>::value))
|
||||
value_test(false, (::boost::is_same<int, const int&>::value))
|
||||
value_test(false, (::boost::is_same<int*, const int*>::value))
|
||||
value_test(false, (::boost::is_same<int*, int*const>::value))
|
||||
value_test(false, (::boost::is_same<int, int[2]>::value))
|
||||
value_test(false, (::boost::is_same<int*, int[2]>::value))
|
||||
value_test(false, (::boost::is_same<int[4], int[2]>::value))
|
||||
value_test(false, (::boost::is_same<void, int>::value))
|
||||
value_test(true, (::boost::is_same<void, void>::value))
|
||||
value_test(false, (::boost::is_same<void, const void>::value))
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef BOOST_MSVC
|
||||
// can't separate void and cv-void:
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/object_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_class)
|
||||
NESTED_DECL(is_object)
|
||||
NESTED_DECL(is_scalar)
|
||||
NESTED_DECL(is_compound)
|
||||
NESTED_DECL(is_POD)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_class, int)
|
||||
NESTED_TEST(is_class, UDT)
|
||||
NESTED_TEST(is_object, int)
|
||||
NESTED_TEST(is_object, void)
|
||||
NESTED_TEST(is_object, UDT)
|
||||
NESTED_TEST(is_scalar, void)
|
||||
NESTED_TEST(is_scalar, int)
|
||||
NESTED_TEST(is_compound, int)
|
||||
NESTED_TEST(is_compound, UDT)
|
||||
NESTED_TEST(is_POD, int)
|
||||
NESTED_TEST(is_POD, UDT)
|
||||
|
||||
value_test(false, boost::is_class<int>::value)
|
||||
value_test(false, boost::is_class<const int>::value)
|
||||
value_test(false, boost::is_class<volatile int>::value)
|
||||
value_test(false, boost::is_class<int*>::value)
|
||||
value_test(false, boost::is_class<int* const>::value)
|
||||
value_test(false, boost::is_class<int[2]>::value)
|
||||
value_test(false, boost::is_class<int&>::value)
|
||||
value_test(false, boost::is_class<mf4>::value)
|
||||
value_test(false, boost::is_class<f1>::value)
|
||||
value_test(false, boost::is_class<enum_UDT>::value)
|
||||
value_test(true, boost::is_class<UDT>::value)
|
||||
value_test(true, boost::is_class<UDT const>::value)
|
||||
value_test(true, boost::is_class<UDT volatile>::value)
|
||||
value_test(true, boost::is_class<empty_UDT>::value)
|
||||
value_test(true, boost::is_class<std::iostream>::value)
|
||||
value_test(false, boost::is_class<UDT*>::value)
|
||||
value_test(false, boost::is_class<UDT[2]>::value)
|
||||
value_test(false, boost::is_class<UDT&>::value)
|
||||
value_test(false, boost::is_class<void>::value)
|
||||
|
||||
value_test(true, boost::is_object<int>::value)
|
||||
value_test(true, boost::is_object<UDT>::value)
|
||||
value_test(false, boost::is_object<int&>::value)
|
||||
value_test(false, boost::is_object<void>::value)
|
||||
|
||||
value_test(true, boost::is_scalar<int>::value)
|
||||
value_test(true, boost::is_scalar<void*>::value)
|
||||
value_test(false, boost::is_scalar<void>::value)
|
||||
value_test(false, boost::is_scalar<UDT>::value)
|
||||
value_test(false, boost::is_scalar<int&>::value)
|
||||
|
||||
value_test(true, boost::is_compound<UDT>::value)
|
||||
value_test(true, boost::is_compound<void*>::value)
|
||||
value_test(false, boost::is_compound<void>::value)
|
||||
value_test(false, boost::is_compound<int>::value)
|
||||
|
||||
value_test(true, boost::is_POD<int>::value)
|
||||
value_test(true, boost::is_POD<int*>::value)
|
||||
value_test(false, boost::is_POD<int&>::value)
|
||||
value_test(true, boost::is_POD<int*const>::value)
|
||||
value_test(true, boost::is_POD<const int>::value)
|
||||
value_test(true, boost::is_POD<volatile int>::value)
|
||||
value_test(false, boost::is_POD<const int&>::value)
|
||||
value_test(true, boost::is_POD<int[2]>::value)
|
||||
value_test(true, boost::is_POD<int[3][2]>::value)
|
||||
value_test(true, boost::is_POD<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::is_POD<f1>::value)
|
||||
value_test(true, boost::is_POD<mf2>::value)
|
||||
value_test(false, boost::is_POD<UDT>::value)
|
||||
value_test(false, boost::is_POD<empty_UDT>::value)
|
||||
value_test(true, boost::is_POD<enum_UDT>::value)
|
||||
value_test(true, boost::is_POD<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_constructor<int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int*>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int*const>::value)
|
||||
value_test(true, boost::has_trivial_constructor<const int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<f1>::value)
|
||||
value_test(true, boost::has_trivial_constructor<mf2>::value)
|
||||
value_test(false, boost::has_trivial_constructor<UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_copy<int>::value)
|
||||
value_test(true, boost::has_trivial_copy<int*>::value)
|
||||
value_test(true, boost::has_trivial_copy<int*const>::value)
|
||||
value_test(true, boost::has_trivial_copy<const int>::value)
|
||||
// Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10
|
||||
value_test(false, boost::has_trivial_copy<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_copy<f1>::value)
|
||||
value_test(true, boost::has_trivial_copy<mf2>::value)
|
||||
value_test(false, boost::has_trivial_copy<UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_assign<int>::value)
|
||||
value_test(true, boost::has_trivial_assign<int*>::value)
|
||||
value_test(false, boost::has_trivial_assign<int*const>::value)
|
||||
value_test(false, boost::has_trivial_assign<const int>::value)
|
||||
// Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10
|
||||
value_test(false, boost::has_trivial_assign<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_assign<f1>::value)
|
||||
value_test(true, boost::has_trivial_assign<mf2>::value)
|
||||
value_test(false, boost::has_trivial_assign<UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_destructor<int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int*>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int*const>::value)
|
||||
value_test(true, boost::has_trivial_destructor<const int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<f1>::value)
|
||||
value_test(true, boost::has_trivial_destructor<mf2>::value)
|
||||
value_test(false, boost::has_trivial_destructor<UDT>::value)
|
||||
value_test(false, boost::has_trivial_destructor<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_destructor<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_destructor<void>::value)
|
||||
|
||||
soft_value_test(false, boost::is_empty<int>::value)
|
||||
soft_value_test(false, boost::is_empty<int*>::value)
|
||||
soft_value_test(false, boost::is_empty<int&>::value)
|
||||
soft_value_test(false, boost::is_empty<void>::value)
|
||||
#if defined(__MWERKS__)
|
||||
// apparent compiler bug causes this to fail to compile:
|
||||
value_fail(false, boost::is_empty<int[2]>::value)
|
||||
#else
|
||||
soft_value_test(false, boost::is_empty<int[2]>::value)
|
||||
#endif
|
||||
soft_value_test(false, boost::is_empty<f1>::value)
|
||||
soft_value_test(false, boost::is_empty<mf1>::value)
|
||||
soft_value_test(false, boost::is_empty<UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<empty_UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<empty_POD_UDT>::value)
|
||||
// this one will not compile on most compilers,
|
||||
// because we can't tell the difference between
|
||||
// unions and classes:
|
||||
value_fail(true, boost::is_empty<empty_union_UDT>::value)
|
||||
soft_value_test(false, boost::is_empty<enum_UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<boost::noncopyable>::value)
|
||||
soft_value_test(false, boost::is_empty<non_empty>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
// can't handle enum's or classes that are POD's
|
||||
unsigned int expected_failures = 10;
|
||||
#elif defined(__GNUC__)
|
||||
// classes that are POD's, or empty:
|
||||
unsigned int expected_failures = 4;
|
||||
#elif defined(BOOST_MSVC)
|
||||
// can't handle classes that are POD's or arrays that are POD's
|
||||
unsigned int expected_failures = 19;
|
||||
#else
|
||||
unsigned int expected_failures = 4;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
|
||||
//
|
||||
// some of these tests, particularly those involving
|
||||
// the use of the transform_check macro are tantamount
|
||||
// to "compiler-abuse", and actually hide a *lot* of
|
||||
// template test code. To prevent "Internal Compiler Error"
|
||||
// type messages, we have to split these up into lots of
|
||||
// separate functions:
|
||||
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
|
||||
#define SHORT_TRANSFORM_TEST
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
#define BOOST_DECL_TRANSFORM_TEST(name, type, from, to)\
|
||||
void name(){ transform_check(type, from, to) }
|
||||
#define BOOST_DECL_TRANSFORM_TEST3(name, type, from)\
|
||||
void name(){ transform_check(type, from, boost_dummy_macro_param) }
|
||||
#define BOOST_DECL_TRANSFORM_TEST2(name, type)\
|
||||
void name(){ transform_check(type, boost_dummy_macro_param, boost_dummy_macro_param) }
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_const:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_const_test_1, ::boost::remove_const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_2, ::boost::remove_const, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_3, ::boost::remove_const, const volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_const_test_4, ::boost::remove_const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_6, ::boost::remove_const, *const, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_7, ::boost::remove_const, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_8, ::boost::remove_const, *const volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_9, ::boost::remove_const, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_11, ::boost::remove_const, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_12, ::boost::remove_const, const[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_13, ::boost::remove_const, volatile[2], volatile[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_14, ::boost::remove_const, const volatile[2], volatile[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_15, ::boost::remove_const, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_16, ::boost::remove_const, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_17, ::boost::remove_const, const*const, const*)
|
||||
|
||||
void check_remove_const()
|
||||
{
|
||||
remove_const_test_1();
|
||||
remove_const_test_2();
|
||||
remove_const_test_3();
|
||||
remove_const_test_4();
|
||||
remove_const_test_6();
|
||||
remove_const_test_7();
|
||||
remove_const_test_8();
|
||||
remove_const_test_9();
|
||||
remove_const_test_11();
|
||||
remove_const_test_12();
|
||||
remove_const_test_13();
|
||||
remove_const_test_14();
|
||||
remove_const_test_15();
|
||||
remove_const_test_16();
|
||||
remove_const_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_volatile:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_1, ::boost::remove_volatile, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_volatile_test_2, ::boost::remove_volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_3, ::boost::remove_volatile, const volatile, const)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_volatile_test_4, ::boost::remove_volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_volatile_test_5, ::boost::remove_volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_6, ::boost::remove_volatile, *const, *const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_7, ::boost::remove_volatile, *volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_8, ::boost::remove_volatile, *const volatile, *const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_9, ::boost::remove_volatile, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_10, ::boost::remove_volatile, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_11, ::boost::remove_volatile, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_12, ::boost::remove_volatile, const[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_13, ::boost::remove_volatile, volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_14, ::boost::remove_volatile, const volatile[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_15, ::boost::remove_volatile, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_16, ::boost::remove_volatile, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_17, ::boost::remove_volatile, const*volatile, const*)
|
||||
|
||||
void check_remove_volatile()
|
||||
{
|
||||
remove_volatile_test_1();
|
||||
remove_volatile_test_2();
|
||||
remove_volatile_test_3();
|
||||
remove_volatile_test_4();
|
||||
remove_volatile_test_5();
|
||||
remove_volatile_test_6();
|
||||
remove_volatile_test_7();
|
||||
remove_volatile_test_8();
|
||||
remove_volatile_test_9();
|
||||
remove_volatile_test_10();
|
||||
remove_volatile_test_11();
|
||||
remove_volatile_test_12();
|
||||
remove_volatile_test_13();
|
||||
remove_volatile_test_14();
|
||||
remove_volatile_test_15();
|
||||
remove_volatile_test_16();
|
||||
remove_volatile_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_cv:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_1, ::boost::remove_cv, const)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_2, ::boost::remove_cv, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_3, ::boost::remove_cv, const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_cv_test_4, ::boost::remove_cv)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_5, ::boost::remove_cv, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_6, ::boost::remove_cv, *const, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_7, ::boost::remove_cv, *volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_8, ::boost::remove_cv, *const volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_9, ::boost::remove_cv, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_10, ::boost::remove_cv, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_11, ::boost::remove_cv, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_12, ::boost::remove_cv, const[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_13, ::boost::remove_cv, volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_14, ::boost::remove_cv, const volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_15, ::boost::remove_cv, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_16, ::boost::remove_cv, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_17, ::boost::remove_cv, const*volatile, const*)
|
||||
|
||||
void check_remove_cv()
|
||||
{
|
||||
remove_cv_test_1();
|
||||
remove_cv_test_2();
|
||||
remove_cv_test_3();
|
||||
remove_cv_test_4();
|
||||
remove_cv_test_5();
|
||||
remove_cv_test_6();
|
||||
remove_cv_test_7();
|
||||
remove_cv_test_8();
|
||||
remove_cv_test_9();
|
||||
remove_cv_test_10();
|
||||
remove_cv_test_11();
|
||||
remove_cv_test_12();
|
||||
remove_cv_test_13();
|
||||
remove_cv_test_14();
|
||||
remove_cv_test_15();
|
||||
remove_cv_test_16();
|
||||
remove_cv_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_reference:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_1, ::boost::remove_reference, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_2, ::boost::remove_reference, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_reference_test_3, ::boost::remove_reference, &)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_reference_test_4, ::boost::remove_reference)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_5, ::boost::remove_reference, const &, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_6, ::boost::remove_reference, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_7, ::boost::remove_reference, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_reference_test_8, ::boost::remove_reference, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_9, ::boost::remove_reference, const &, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_10, ::boost::remove_reference, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_11, ::boost::remove_reference, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_12, ::boost::remove_reference, const[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_13, ::boost::remove_reference, (&)[2], [2])
|
||||
|
||||
void check_remove_reference()
|
||||
{
|
||||
remove_reference_test_1();
|
||||
remove_reference_test_2();
|
||||
remove_reference_test_3();
|
||||
remove_reference_test_4();
|
||||
remove_reference_test_5();
|
||||
remove_reference_test_6();
|
||||
remove_reference_test_7();
|
||||
remove_reference_test_8();
|
||||
remove_reference_test_9();
|
||||
remove_reference_test_10();
|
||||
remove_reference_test_11();
|
||||
remove_reference_test_12();
|
||||
remove_reference_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_bounds:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_1, ::boost::remove_bounds, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_2, ::boost::remove_bounds, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_bounds_test_3, ::boost::remove_bounds, [2])
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_bounds_test_4, ::boost::remove_bounds)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_5, ::boost::remove_bounds, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_6, ::boost::remove_bounds, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_7, ::boost::remove_bounds, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_8, ::boost::remove_bounds, const [2], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_9, ::boost::remove_bounds, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_10, ::boost::remove_bounds, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_11, ::boost::remove_bounds, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_12, ::boost::remove_bounds, const[2][3], const[3])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_13, ::boost::remove_bounds, (&)[2], (&)[2])
|
||||
|
||||
void check_remove_bounds()
|
||||
{
|
||||
remove_bounds_test_1();
|
||||
remove_bounds_test_2();
|
||||
remove_bounds_test_3();
|
||||
remove_bounds_test_4();
|
||||
remove_bounds_test_5();
|
||||
remove_bounds_test_6();
|
||||
remove_bounds_test_7();
|
||||
remove_bounds_test_8();
|
||||
remove_bounds_test_9();
|
||||
remove_bounds_test_10();
|
||||
remove_bounds_test_11();
|
||||
remove_bounds_test_12();
|
||||
remove_bounds_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_pointer:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_1, ::boost::remove_pointer, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_2, ::boost::remove_pointer, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_3, ::boost::remove_pointer, *)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_pointer_test_4, ::boost::remove_pointer)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_5, ::boost::remove_pointer, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_6, ::boost::remove_pointer, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_7, ::boost::remove_pointer, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_8, ::boost::remove_pointer, const [2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_9, ::boost::remove_pointer, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_10, ::boost::remove_pointer, const*, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_11, ::boost::remove_pointer, volatile*, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_12, ::boost::remove_pointer, const[2][3], const[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_13, ::boost::remove_pointer, (&)[2], (&)[2])
|
||||
|
||||
void check_remove_pointer()
|
||||
{
|
||||
remove_pointer_test_1();
|
||||
remove_pointer_test_2();
|
||||
remove_pointer_test_3();
|
||||
remove_pointer_test_4();
|
||||
remove_pointer_test_5();
|
||||
remove_pointer_test_6();
|
||||
remove_pointer_test_7();
|
||||
remove_pointer_test_8();
|
||||
remove_pointer_test_9();
|
||||
remove_pointer_test_10();
|
||||
remove_pointer_test_11();
|
||||
remove_pointer_test_12();
|
||||
remove_pointer_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for add_reference:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_1, ::boost::add_reference, const, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_2, ::boost::add_reference, volatile, volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_3, ::boost::add_reference, *, *&)
|
||||
//BOOST_DECL_TRANSFORM_TEST2(add_reference_test_4, ::boost::add_reference)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_5, ::boost::add_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_6, ::boost::add_reference, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_7, ::boost::add_reference, *volatile, *volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_8, ::boost::add_reference, const [2], const (&)[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_9, ::boost::add_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_10, ::boost::add_reference, const*, const*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_11, ::boost::add_reference, volatile*, volatile*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_12, ::boost::add_reference, const[2][3], const (&)[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_13, ::boost::add_reference, (&)[2], (&)[2])
|
||||
|
||||
void check_add_reference()
|
||||
{
|
||||
add_reference_test_1();
|
||||
add_reference_test_2();
|
||||
add_reference_test_3();
|
||||
//add_reference_test_4();
|
||||
add_reference_test_5();
|
||||
add_reference_test_6();
|
||||
add_reference_test_7();
|
||||
add_reference_test_8();
|
||||
add_reference_test_9();
|
||||
add_reference_test_10();
|
||||
add_reference_test_11();
|
||||
add_reference_test_12();
|
||||
add_reference_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for add_pointer:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_1, ::boost::add_pointer, const, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_2, ::boost::add_pointer, volatile, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_3, ::boost::add_pointer, *, **)
|
||||
//BOOST_DECL_TRANSFORM_TEST2(add_pointer_test_4, ::boost::add_pointer)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_7, ::boost::add_pointer, *volatile, *volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_10, ::boost::add_pointer, const*, const**)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_11, ::boost::add_pointer, volatile*, volatile**)
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_5, ::boost::add_pointer, const &, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_6, ::boost::add_pointer, &, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_8, ::boost::add_pointer, const [2], const *)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_9, ::boost::add_pointer, const &, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_12, ::boost::add_pointer, const[2][3], const (*)[3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_13, ::boost::add_pointer, (&)[2], *)
|
||||
#endif
|
||||
|
||||
void check_add_pointer()
|
||||
{
|
||||
add_pointer_test_1();
|
||||
add_pointer_test_2();
|
||||
add_pointer_test_3();
|
||||
//add_pointer_test_4();
|
||||
add_pointer_test_7();
|
||||
add_pointer_test_10();
|
||||
add_pointer_test_11();
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
add_pointer_test_5();
|
||||
add_pointer_test_6();
|
||||
add_pointer_test_8();
|
||||
add_pointer_test_9();
|
||||
add_pointer_test_12();
|
||||
add_pointer_test_13();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
check_remove_const();
|
||||
check_remove_volatile();
|
||||
check_remove_cv();
|
||||
check_remove_reference();
|
||||
check_remove_bounds();
|
||||
check_remove_pointer();
|
||||
check_add_reference();
|
||||
check_add_pointer();
|
||||
|
||||
type_test(void, boost::remove_const<void>::type)
|
||||
type_test(void, boost::remove_volatile<void>::type)
|
||||
type_test(void, boost::remove_cv<void>::type)
|
||||
|
||||
type_test(int, boost::remove_reference<cr_type>::type)
|
||||
type_test(void, boost::remove_reference<void>::type)
|
||||
|
||||
type_test(void, boost::remove_bounds<void>::type)
|
||||
type_test(void, boost::remove_pointer<void>::type)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
#ifdef SHORT_TRANSFORM_TEST
|
||||
unsigned int expected_failures = 97; // cv-qualifiers
|
||||
#else
|
||||
unsigned int expected_failures = 422; // cv-qualifiers
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
unsigned int expected_failures = 1; // cv-qualified references
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user