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_back;
20
21 {
22 using L1 = mp_list<>;
23
24 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1>, L1>));
25
26 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void>, mp_list<void>>));
27 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, int>, mp_list<int>>));
28 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void, int>, mp_list<void, int>>));
29 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void, int, char[]>, mp_list<void, int, char[]>>));
30 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<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_back<L2>, L2>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, void>, L2>));
38
39 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int>, mp_list<void, int>>));
40 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int, void>, mp_list<void, int>>));
41 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int, int, int, void, void, void>, mp_list<void, int>>));
42 }
43
44 {
45 using L3 = mp_list<void, int>;
46
47 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3>, L3>));
48 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, void>, L3>));
49 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int>, L3>));
50 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int, int, int, void, void, void>, L3>));
51
52 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, void const>, mp_list<void, int, void const>>));
53 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int, char[], int, char[], void, char[], void, char[]>, mp_list<void, int, char[]>>));
54 }
55
56 {
57 using L4 = mp_list<void, int, char[]>;
58
59 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4>, L4>));
60 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void>, L4>));
61 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, int>, L4>));
62 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, char[]>, L4>));
63 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void, int, char[], void, int, char[]>, L4>));
64
65 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void const>, mp_list<void, int, char[], void const>>));
66 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void const, int const, char const[]>, mp_list<void, int, char[], void const, int const, char const[]>>));
67 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void, void const, int, int const, char[], char const[]>, mp_list<void, int, char[], void const, int const, char const[]>>));
68 }
69
70 //
71
72 {
73 using L1 = std::tuple<>;
74
75 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1>, L1>));
76
77 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void>, std::tuple<void>>));
78 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, int>, std::tuple<int>>));
79 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void, int>, std::tuple<void, int>>));
80 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void, int, char[]>, std::tuple<void, int, char[]>>));
81 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L1, void, int, void, int, void, int>, std::tuple<void, int>>));
82 }
83
84 {
85 using L2 = std::tuple<void>;
86
87 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2>, L2>));
88 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, void>, L2>));
89
90 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int>, std::tuple<void, int>>));
91 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int, void>, std::tuple<void, int>>));
92 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L2, int, int, int, void, void, void>, std::tuple<void, int>>));
93 }
94
95 {
96 using L3 = std::tuple<void, int>;
97
98 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3>, L3>));
99 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, void>, L3>));
100 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int>, L3>));
101 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int, int, int, void, void, void>, L3>));
102
103 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, void const>, std::tuple<void, int, void const>>));
104 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L3, int, char[], int, char[], void, char[], void, char[]>, std::tuple<void, int, char[]>>));
105 }
106
107 {
108 using L4 = std::tuple<void, int, char[]>;
109
110 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4>, L4>));
111 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void>, L4>));
112 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, int>, L4>));
113 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, char[]>, L4>));
114 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void, int, char[], void, int, char[]>, L4>));
115
116 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void const>, std::tuple<void, int, char[], void const>>));
117 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void const, int const, char const[]>, std::tuple<void, int, char[], void const, int const, char const[]>>));
118 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_back<L4, void, void const, int, int const, char[], char const[]>, std::tuple<void, int, char[], void const, int const, char const[]>>));
119 }
120
121 return boost::report_errors();
122 }
123