• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4 
5 #ifndef BOOST_HANA_TEST_AUTO_INSERT_HPP
6 #define BOOST_HANA_TEST_AUTO_INSERT_HPP
7 
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/equal.hpp>
10 #include <boost/hana/insert.hpp>
11 #include <boost/hana/integral_constant.hpp>
12 
13 #include "test_case.hpp"
14 #include <laws/base.hpp>
15 
16 
__anon53ca626e0102null17 TestCase test_insert{[]{
18     namespace hana = boost::hana;
19     using hana::test::ct_eq;
20 
21     auto z = ct_eq<999>{};
22 
23     BOOST_HANA_CONSTANT_CHECK(hana::equal(
24         hana::insert(MAKE_TUPLE(ct_eq<0>{}), hana::size_c<0>, z),
25         MAKE_TUPLE(z, ct_eq<0>{})
26     ));
27     BOOST_HANA_CONSTANT_CHECK(hana::equal(
28         hana::insert(MAKE_TUPLE(ct_eq<0>{}), hana::size_c<1>, z),
29         MAKE_TUPLE(ct_eq<0>{}, z)
30     ));
31 
32     BOOST_HANA_CONSTANT_CHECK(hana::equal(
33         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}), hana::size_c<0>, z),
34         MAKE_TUPLE(z, ct_eq<0>{}, ct_eq<1>{})
35     ));
36     BOOST_HANA_CONSTANT_CHECK(hana::equal(
37         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}), hana::size_c<1>, z),
38         MAKE_TUPLE(ct_eq<0>{}, z, ct_eq<1>{})
39     ));
40     BOOST_HANA_CONSTANT_CHECK(hana::equal(
41         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}), hana::size_c<2>, z),
42         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, z)
43     ));
44 
45     BOOST_HANA_CONSTANT_CHECK(hana::equal(
46         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), hana::size_c<0>, z),
47         MAKE_TUPLE(z, ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
48     ));
49     BOOST_HANA_CONSTANT_CHECK(hana::equal(
50         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), hana::size_c<1>, z),
51         MAKE_TUPLE(ct_eq<0>{}, z, ct_eq<1>{}, ct_eq<2>{})
52     ));
53     BOOST_HANA_CONSTANT_CHECK(hana::equal(
54         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), hana::size_c<2>, z),
55         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, z, ct_eq<2>{})
56     ));
57     BOOST_HANA_CONSTANT_CHECK(hana::equal(
58         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), hana::size_c<3>, z),
59         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, z)
60     ));
61 
62     BOOST_HANA_CONSTANT_CHECK(hana::equal(
63         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::size_c<0>, z),
64         MAKE_TUPLE(z, ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
65     ));
66     BOOST_HANA_CONSTANT_CHECK(hana::equal(
67         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::size_c<1>, z),
68         MAKE_TUPLE(ct_eq<0>{}, z, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
69     ));
70     BOOST_HANA_CONSTANT_CHECK(hana::equal(
71         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::size_c<2>, z),
72         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, z, ct_eq<2>{}, ct_eq<3>{})
73     ));
74     BOOST_HANA_CONSTANT_CHECK(hana::equal(
75         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::size_c<3>, z),
76         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, z, ct_eq<3>{})
77     ));
78     BOOST_HANA_CONSTANT_CHECK(hana::equal(
79         hana::insert(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::size_c<4>, z),
80         MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, z)
81     ));
82 }};
83 
84 #endif // !BOOST_HANA_TEST_AUTO_INSERT_HPP
85