bool.cpp 955 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright Aleksey Gurtovoy 2001-2004
  2. //
  3. // Distributed under the Boost Software License,Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/mpl for documentation.
  8. // $Id$
  9. // $Date$
  10. // $Revision$
  11. #include <boost/mpl/bool.hpp>
  12. #include <boost/mpl/aux_/test.hpp>
  13. #include <cassert>
  14. #if defined(BOOST_NO_CXX11_CONSTEXPR)
  15. #define CONSTEXPR_BOOL_TEST(c)
  16. #else
  17. #define CONSTEXPR_BOOL_TEST(c) { static_assert(bool_<c>() == c, "Constexpr for bool_ failed"); }
  18. #endif
  19. #define BOOL_TEST(c) \
  20. { MPL_ASSERT(( is_same< bool_<c>::value_type, bool > )); } \
  21. { MPL_ASSERT(( is_same< bool_<c>, c##_ > )); } \
  22. { MPL_ASSERT(( is_same< bool_<c>::type, bool_<c> > )); } \
  23. { MPL_ASSERT_RELATION( bool_<c>::value, ==, c ); } \
  24. CONSTEXPR_BOOL_TEST(c) \
  25. BOOST_TEST( bool_<c>() == c ); \
  26. /**/
  27. MPL_TEST_CASE()
  28. {
  29. BOOL_TEST(true)
  30. BOOL_TEST(false)
  31. }