| 1 | |
| 2 | // Copyright 2015 Peter Dimov. |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. |
| 5 | // |
| 6 | // See accompanying file LICENSE_1_0.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt |
| 8 | |
| 9 | |
| 10 | #include <boost/mp11/integral.hpp> |
| 11 | #include <boost/core/lightweight_test_trait.hpp> |
| 12 | #include <type_traits> |
| 13 | #include <cstddef> |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | using boost::mp11::mp_bool; |
| 18 | |
| 19 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bool<false>, std::integral_constant<bool, false>>)); |
| 20 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bool<true>, std::integral_constant<bool, true>>)); |
| 21 | |
| 22 | using boost::mp11::mp_true; |
| 23 | using boost::mp11::mp_false; |
| 24 | |
| 25 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_false, std::integral_constant<bool, false>>)); |
| 26 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_true, std::integral_constant<bool, true>>)); |
| 27 | |
| 28 | using boost::mp11::mp_int; |
| 29 | |
| 30 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_int<0>, std::integral_constant<int, 0>>)); |
| 31 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_int<814>, std::integral_constant<int, 814>>)); |
| 32 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_int<-144>, std::integral_constant<int, -144>>)); |
| 33 | |
| 34 | using boost::mp11::mp_size_t; |
| 35 | |
| 36 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size_t<0>, std::integral_constant<std::size_t, 0>>)); |
| 37 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size_t<1972>, std::integral_constant<std::size_t, 1972>>)); |
| 38 | |
| 39 | using boost::mp11::mp_to_bool; |
| 40 | |
| 41 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_false>, mp_false>)); |
| 42 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_true>, mp_true>)); |
| 43 | |
| 44 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_int<0>>, mp_false>)); |
| 45 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_int<1>>, mp_true>)); |
| 46 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_int<107>>, mp_true>)); |
| 47 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_int<-1>>, mp_true>)); |
| 48 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_int<-91>>, mp_true>)); |
| 49 | |
| 50 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_size_t<0>>, mp_false>)); |
| 51 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_size_t<1>>, mp_true>)); |
| 52 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_to_bool<mp_size_t<442>>, mp_true>)); |
| 53 | |
| 54 | using boost::mp11::mp_not; |
| 55 | |
| 56 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_false>, mp_true>)); |
| 57 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_true>, mp_false>)); |
| 58 | |
| 59 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_int<0>>, mp_true>)); |
| 60 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_int<1>>, mp_false>)); |
| 61 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_int<107>>, mp_false>)); |
| 62 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_int<-1>>, mp_false>)); |
| 63 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_int<-91>>, mp_false>)); |
| 64 | |
| 65 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_size_t<0>>, mp_true>)); |
| 66 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_size_t<1>>, mp_false>)); |
| 67 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_not<mp_size_t<442>>, mp_false>)); |
| 68 | |
| 69 | return boost::report_errors(); |
| 70 | } |
| 71 | |