• 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 #include <boost/hana/detail/variadic/take.hpp>
6 
7 #include <boost/hana/assert.hpp>
8 #include <boost/hana/equal.hpp>
9 
10 #include <laws/base.hpp>
11 namespace hana = boost::hana;
12 namespace vd = hana::detail::variadic;
13 using hana::test::ct_eq;
14 
15 
main()16 int main() {
17     hana::test::_injection<0> f{};
18 
19     {
20         BOOST_HANA_CONSTANT_CHECK(hana::equal(
21             vd::take<0>()(f),
22             f()
23         ));
24 
25         BOOST_HANA_CONSTANT_CHECK(hana::equal(
26             vd::take<0>(ct_eq<1>{})(f),
27             f()
28         ));
29 
30         BOOST_HANA_CONSTANT_CHECK(hana::equal(
31             vd::take<0>(ct_eq<1>{}, ct_eq<2>{})(f),
32             f()
33         ));
34     }
35     {
36         BOOST_HANA_CONSTANT_CHECK(hana::equal(
37             vd::take<1>(ct_eq<1>{})(f),
38             f(ct_eq<1>{})
39         ));
40 
41         BOOST_HANA_CONSTANT_CHECK(hana::equal(
42             vd::take<1>(ct_eq<1>{}, ct_eq<2>{})(f),
43             f(ct_eq<1>{})
44         ));
45 
46         BOOST_HANA_CONSTANT_CHECK(hana::equal(
47             vd::take<1>(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})(f),
48             f(ct_eq<1>{})
49         ));
50     }
51     {
52         BOOST_HANA_CONSTANT_CHECK(hana::equal(
53             vd::take<8>(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{}, ct_eq<5>{}, ct_eq<6>{}, ct_eq<7>{}, ct_eq<8>{})(f),
54             f(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{}, ct_eq<5>{}, ct_eq<6>{}, ct_eq<7>{}, ct_eq<8>{})
55         ));
56 
57         BOOST_HANA_CONSTANT_CHECK(hana::equal(
58             vd::take<8>(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{}, ct_eq<5>{}, ct_eq<6>{}, ct_eq<7>{}, ct_eq<8>{}, ct_eq<9>{})(f),
59             f(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{}, ct_eq<5>{}, ct_eq<6>{}, ct_eq<7>{}, ct_eq<8>{})
60         ));
61     }
62 }
63