2 // (C) Copyright John Maddock 2000.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_CHECK_TYPE_HPP
8 #define BOOST_CHECK_TYPE_HPP
11 #include <boost/type_traits/is_same.hpp>
15 BOOST_CHECK_TYPE(type_expression, expected_type)
17 type_expression: an expression that evaluates to a typename.
18 expected_value: the type we expect to find.
22 #pragma option -w-8008 -w-8066 -w-8019
26 #define BOOST_CHECK_TYPE(type_expression, expected_type)\
28 if(!::boost::is_same< type_expression, expected_type >::value){\
29 BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
30 << "\" did not have the expected type:\n\tevaluating: boost::is_same<"\
31 << BOOST_STRINGIZE(type_expression) << ", " << BOOST_STRINGIZE(expected_type)\
32 << ">" << "\n\tfound: "\
33 << typeid(::boost::is_same< type_expression, expected_type >).name());\
35 BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
36 << BOOST_STRINGIZE(expression) << "\"");\
39 #define BOOST_CHECK_TYPE3(type_expression, type_expression_suffix, expected_type)\
41 if(!::boost::is_same< type_expression, type_expression_suffix, expected_type >::value){\
42 BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
43 << "\" did not have the expected type:\n\tevaluating: boost::is_same<"\
44 << BOOST_STRINGIZE((type_expression, type_expression_suffix)) << ", " << BOOST_STRINGIZE(expected_type)\
45 << ">" << "\n\tfound: "\
46 << typeid(::boost::is_same< type_expression, type_expression_suffix, expected_type >).name());\
48 BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
49 << BOOST_STRINGIZE(expression) << "\"");\
52 #define BOOST_CHECK_TYPE4(type_expression, suffix1, suffix2, expected_type)\
54 if(!::boost::is_same< type_expression, suffix1, suffix2, expected_type >::value){\
55 BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
56 << "\" did not have the expected type:\n\tevaluating: boost::is_same<"\
57 << BOOST_STRINGIZE((type_expression, suffix1, suffix2)) << ", " << BOOST_STRINGIZE(expected_type)\
58 << ">" << "\n\tfound: "\
59 << typeid(::boost::is_same< type_expression, suffix1, suffix2, expected_type >).name());\
61 BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
62 << BOOST_STRINGIZE(expression) << "\"");\