• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright 2017 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/map.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/integral.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
15 #include <tuple>
16 #include <utility>
17 
main()18 int main()
19 {
20     using boost::mp11::mp_is_map;
21     using boost::mp11::mp_list;
22     using boost::mp11::mp_true;
23     using boost::mp11::mp_false;
24 
25     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<void>, mp_false>));
26 
27     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<>>, mp_true>));
28     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<>>, mp_true>));
29 
30     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<void>>, mp_false>));
31     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<void>>, mp_false>));
32 
33     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<mp_list<>>>, mp_false>));
34     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::tuple<>>>, mp_false>));
35 
36     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<mp_list<int>>>, mp_true>));
37     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::tuple<int>>>, mp_true>));
38 
39     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<std::pair<int, int const>>>, mp_true>));
40     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::pair<int, int const>>>, mp_true>));
41 
42     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<std::pair<int, int const>, std::pair<long, long const>>>, mp_true>));
43     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::pair<int, int const>, std::pair<long, long const>>>, mp_true>));
44     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::pair<std::pair<int, int const>, std::pair<long, long const>>>, mp_true>));
45 
46     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<std::pair<int, int const>, std::pair<int, long const>>>, mp_false>));
47     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::pair<int, int const>, std::pair<int, long const>>>, mp_false>));
48     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::pair<std::pair<int, int const>, std::pair<int, long const>>>, mp_false>));
49 
50     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<mp_list<int>, mp_list<long, long>, mp_list<long long, long long, long long>>>, mp_true>));
51     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<mp_list<int>, mp_list<long, long>, mp_list<long long, long long, long long>>>, mp_true>));
52     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::tuple<int>, std::pair<long, long>, std::tuple<long long, long long, long long>>>, mp_true>));
53 
54     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<mp_list<mp_list<int>, mp_list<long, long>, mp_list<int, long long, long long>>>, mp_false>));
55     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<mp_list<int>, mp_list<long, long>, mp_list<int, long long, long long>>>, mp_false>));
56     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_is_map<std::tuple<std::tuple<int>, std::pair<long, long>, std::tuple<int, long long, long long>>>, mp_false>));
57 
58     return boost::report_errors();
59 }
60