diff --git a/call_traits_test.cpp b/call_traits_test.cpp index 0c7155e..da41fd1 100644 --- a/call_traits_test.cpp +++ b/call_traits_test.cpp @@ -16,7 +16,7 @@ #include #include -#include "type_traits_test.hpp" +#include // // struct contained models a type that contains a type (for example std::pair) // arrays are contained by value, and have to be treated as a special case: @@ -98,18 +98,18 @@ std::pair< using namespace std; // -// struct checker: +// struct call_traits_checker: // verifies behaviour of contained example: // template -struct checker +struct call_traits_checker { typedef typename boost::call_traits::param_type param_type; void operator()(param_type); }; template -void checker::operator()(param_type p) +void call_traits_checker::operator()(param_type p) { T t(p); contained c(t); @@ -128,7 +128,7 @@ void checker::operator()(param_type p) #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template -struct checker +struct call_traits_checker { typedef typename boost::call_traits::param_type param_type; void operator()(param_type t) @@ -176,32 +176,32 @@ void check_make_pair(T c, U u, V v) } -struct UDT +struct comparible_UDT { int i_; - UDT() : i_(2){} - bool operator == (const UDT& v){ return v.i_ == i_; } + comparible_UDT() : i_(2){} + bool operator == (const comparible_UDT& v){ return v.i_ == i_; } }; -int main() +int main(int argc, char *argv[ ]) { - checker c1; - UDT u; + call_traits_checker c1; + comparible_UDT u; c1(u); - checker c2; + call_traits_checker c2; int i = 2; c2(i); int* pi = &i; #if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) - checker c3; + call_traits_checker c3; c3(pi); - checker c4; + call_traits_checker c4; c4(i); - checker c5; + call_traits_checker c5; c5(i); #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) int a[2] = {1,2}; - checker c6; + call_traits_checker c6; c6(a); #endif #endif @@ -220,10 +220,10 @@ int main() typedef int& r_type; typedef const r_type cr_type; - type_test(UDT, boost::call_traits::value_type) - type_test(UDT&, boost::call_traits::reference) - type_test(const UDT&, boost::call_traits::const_reference) - type_test(const UDT&, boost::call_traits::param_type) + type_test(comparible_UDT, boost::call_traits::value_type) + type_test(comparible_UDT&, boost::call_traits::reference) + type_test(const comparible_UDT&, boost::call_traits::const_reference) + type_test(const comparible_UDT&, boost::call_traits::param_type) type_test(int, boost::call_traits::value_type) type_test(int&, boost::call_traits::reference) type_test(const int&, boost::call_traits::const_reference) @@ -271,9 +271,7 @@ int main() test_count += 20; #endif - std::cout << std::endl << test_count << " tests completed (" << failures << " failures)... press any key to exit"; - std::cin.get(); - return failures; + return check_result(argc, argv); } // @@ -364,3 +362,11 @@ template struct call_traits_test; #endif #endif +#ifdef BOOST_MSVC +unsigned int expected_failures = 10; +#elif defined(__BORLANDC__) +unsigned int expected_failures = 2; +#else +unsigned int expected_failures = 0; +#endif + diff --git a/compressed_pair_test.cpp b/compressed_pair_test.cpp index 751ab9e..4da8a91 100644 --- a/compressed_pair_test.cpp +++ b/compressed_pair_test.cpp @@ -14,15 +14,10 @@ #include #include -#include "type_traits_test.hpp" +#include using namespace boost; -struct empty_POD_UDT{}; -struct empty_UDT -{ - ~empty_UDT(){}; -}; namespace boost { #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION template <> struct is_empty @@ -59,7 +54,7 @@ struct non_empty2 { return a.i == b.i; } }; -int main() +int main(int argc, char *argv[ ]) { compressed_pair cp1(1, 1.3); assert(cp1.first() == 1); @@ -107,9 +102,7 @@ int main() value_test(true, (sizeof(compressed_pair) < sizeof(std::pair))) value_test(true, (sizeof(compressed_pair >) < sizeof(std::pair >))) - std::cout << std::endl << test_count << " tests completed (" << failures << " failures)... press any key to exit"; - std::cin.get(); - return failures; + return check_result(argc, argv); } // @@ -154,6 +147,15 @@ template compressed_pair::compressed_pair(); #endif // __MWERKS__ #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#ifdef __BORLANDC__ +// can't handle both types empty: +unsigned int expected_failures = 1; +#elif defined(__GNUC__) +// no zero sized base classes: +unsigned int expected_failures = 4; +#else +unsigned int expected_failures = 0; +#endif diff --git a/include/boost/detail/call_traits.hpp b/include/boost/detail/call_traits.hpp index 304a686..1fa47f0 100644 --- a/include/boost/detail/call_traits.hpp +++ b/include/boost/detail/call_traits.hpp @@ -23,8 +23,11 @@ #include #endif -#ifndef BOOST_TYPE_TRAITS_HPP -#include +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +#ifndef COMPOSITE_TYPE_TRAITS_HPP +#include #endif namespace boost{ diff --git a/include/boost/detail/compressed_pair.hpp b/include/boost/detail/compressed_pair.hpp index c2b9bef..80564ce 100644 --- a/include/boost/detail/compressed_pair.hpp +++ b/include/boost/detail/compressed_pair.hpp @@ -19,8 +19,8 @@ #define BOOST_DETAIL_COMPRESSED_PAIR_HPP #include -#ifndef BOOST_TYPE_TRAITS_HPP -#include +#ifndef OBJECT_TYPE_TRAITS_HPP +#include #endif #ifndef BOOST_CALL_TRAITS_HPP #include diff --git a/include/boost/detail/ob_call_traits.hpp b/include/boost/detail/ob_call_traits.hpp index a031f17..7490513 100644 --- a/include/boost/detail/ob_call_traits.hpp +++ b/include/boost/detail/ob_call_traits.hpp @@ -24,8 +24,11 @@ #include #endif -#ifndef BOOST_TYPE_TRAITS_HPP -#include +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +#ifndef COMPOSITE_TYPE_TRAITS_HPP +#include #endif namespace boost{ diff --git a/include/boost/detail/ob_compressed_pair.hpp b/include/boost/detail/ob_compressed_pair.hpp index 16c23d0..42e4c35 100644 --- a/include/boost/detail/ob_compressed_pair.hpp +++ b/include/boost/detail/ob_compressed_pair.hpp @@ -26,8 +26,8 @@ #define BOOST_OB_COMPRESSED_PAIR_HPP #include -#ifndef BOOST_TYPE_TRAITS_HPP -#include +#ifndef OBJECT_TYPE_TRAITS_HPP +#include #endif #ifndef BOOST_CALL_TRAITS_HPP #include