]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/include/boost/core/lightweight_test_trait.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / core / include / boost / core / lightweight_test_trait.hpp
1 #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
2 #define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
3
4 // MS compatible compilers support #pragma once
5
6 #if defined(_MSC_VER)
7 # pragma once
8 #endif
9
10 // boost/core/lightweight_test_trait.hpp
11 //
12 // BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE
13 //
14 // Copyright 2014 Peter Dimov
15 //
16 // Distributed under the Boost Software License, Version 1.0.
17 // See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt
19
20 #include <boost/core/lightweight_test.hpp>
21 #include <boost/core/typeinfo.hpp>
22
23 namespace boost
24 {
25
26 namespace detail
27 {
28
29 template< class T > inline void test_trait_impl( char const * trait, void (*)( T ),
30 bool expected, char const * file, int line, char const * function )
31 {
32 if( T::value == expected )
33 {
34 report_errors_remind();
35 }
36 else
37 {
38 BOOST_LIGHTWEIGHT_TEST_OSTREAM
39 << file << "(" << line << "): predicate '" << trait << "' ["
40 << boost::core::demangled_name( BOOST_CORE_TYPEID(T) ) << "]"
41 << " test failed in function '" << function
42 << "' (should have been " << ( expected? "true": "false" ) << ")"
43 << std::endl;
44
45 ++test_errors();
46 }
47 }
48
49 } // namespace detail
50
51 } // namespace boost
52
53 #define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
54 #define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
55
56 #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP