• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/set.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/core/lightweight_test_trait.hpp>
13 #include <type_traits>
14 #include <tuple>
15 
main()16 int main()
17 {
18     using boost::mp11::mp_list;
19     using boost::mp11::mp_set_push_front;
20 
21     {
22         using L1 = mp_list<>;
23 
24         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1>, L1>));
25 
26         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void>, mp_list<void>>));
27         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, int>, mp_list<int>>));
28         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int>, mp_list<void, int>>));
29         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, char[]>, mp_list<void, int, char[]>>));
30         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, void, int, void, int>, mp_list<void, int>>));
31     }
32 
33     {
34         using L2 = mp_list<void>;
35 
36         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2>, L2>));
37         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void>, L2>));
38 
39         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, int>, mp_list<int, void>>));
40         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, int>, mp_list<int, void>>));
41         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, void, void, int, int, int>, mp_list<int, void>>));
42     }
43 
44     {
45         using L3 = mp_list<void, int>;
46 
47         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3>, L3>));
48         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void>, L3>));
49         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int>, L3>));
50         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, int, int, void, void, void>, L3>));
51 
52         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const>, mp_list<void const, void, int>>));
53         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const, int const>, mp_list<void const, int const, void, int>>));
54         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, char[], int, char[], void, char[], void, char[]>, mp_list<char[], void, int>>));
55     }
56 
57     {
58         using L4 = mp_list<void, int, char[]>;
59 
60         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4>, L4>));
61         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void>, L4>));
62         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, int>, L4>));
63         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, char[]>, L4>));
64         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, int, char[], void, int, char[]>, L4>));
65 
66         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const>, mp_list<void const, void, int, char[]>>));
67         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const, int const, char const[]>, mp_list<void const, int const, char const[], void, int, char[]>>));
68         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, void const, int, int const, char[], char const[]>, mp_list<void const, int const, char const[], void, int, char[]>>));
69     }
70 
71     //
72 
73     {
74         using L1 = std::tuple<>;
75 
76         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1>, L1>));
77 
78         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void>, std::tuple<void>>));
79         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, int>, std::tuple<int>>));
80         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int>, std::tuple<void, int>>));
81         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, char[]>, std::tuple<void, int, char[]>>));
82         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, void, int, void, int>, std::tuple<void, int>>));
83     }
84 
85     {
86         using L2 = std::tuple<void>;
87 
88         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2>, L2>));
89         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void>, L2>));
90 
91         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, int>, std::tuple<int, void>>));
92         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, int>, std::tuple<int, void>>));
93         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, void, void, int, int, int>, std::tuple<int, void>>));
94     }
95 
96     {
97         using L3 = std::tuple<void, int>;
98 
99         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3>, L3>));
100         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void>, L3>));
101         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int>, L3>));
102         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, int, int, void, void, void>, L3>));
103 
104         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const>, std::tuple<void const, void, int>>));
105         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const, int const>, std::tuple<void const, int const, void, int>>));
106         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, char[], int, char[], void, char[], void, char[]>, std::tuple<char[], void, int>>));
107     }
108 
109     {
110         using L4 = std::tuple<void, int, char[]>;
111 
112         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4>, L4>));
113         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void>, L4>));
114         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, int>, L4>));
115         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, char[]>, L4>));
116         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, int, char[], void, int, char[]>, L4>));
117 
118         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const>, std::tuple<void const, void, int, char[]>>));
119         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const, int const, char const[]>, std::tuple<void const, int const, char const[], void, int, char[]>>));
120         BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, void const, int, int const, char[], char const[]>, std::tuple<void const, int const, char const[], void, int, char[]>>));
121     }
122 
123     return boost::report_errors();
124 }
125