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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/experimental/types.hpp>
8 #include <boost/hana/type.hpp>
9 #include <boost/hana/unpack.hpp>
11 #include <laws/base.hpp>
12 namespace hana = boost::hana;
15 template <typename ...>
16 struct mf { struct type; };
18 template <int> struct x;
21 // with a Metafunction
23 BOOST_HANA_CONSTANT_CHECK(hana::equal(
24 hana::unpack(hana::experimental::types<>{}, hana::metafunction<mf>),
25 hana::type_c<mf<>::type>
28 BOOST_HANA_CONSTANT_CHECK(hana::equal(
29 hana::unpack(hana::experimental::types<x<0>>{}, hana::metafunction<mf>),
30 hana::type_c<mf<x<0>>::type>
33 BOOST_HANA_CONSTANT_CHECK(hana::equal(
34 hana::unpack(hana::experimental::types<x<0>, x<1>>{}, hana::metafunction<mf>),
35 hana::type_c<mf<x<0>, x<1>>::type>
38 BOOST_HANA_CONSTANT_CHECK(hana::equal(
39 hana::unpack(hana::experimental::types<x<0>, x<1>, x<2>>{}, hana::metafunction<mf>),
40 hana::type_c<mf<x<0>, x<1>, x<2>>::type>
43 BOOST_HANA_CONSTANT_CHECK(hana::equal(
44 hana::unpack(hana::experimental::types<x<0>, x<1>, x<2>, x<3>>{}, hana::metafunction<mf>),
45 hana::type_c<mf<x<0>, x<1>, x<2>, x<3>>::type>
48 BOOST_HANA_CONSTANT_CHECK(hana::equal(
49 hana::unpack(hana::experimental::types<x<0>, x<1>, x<2>, x<3>, x<4>>{}, hana::metafunction<mf>),
50 hana::type_c<mf<x<0>, x<1>, x<2>, x<3>, x<4>>::type>
54 // with a non-Metafunction
56 auto f = hana::test::_injection<0>{};
58 BOOST_HANA_CONSTANT_CHECK(hana::equal(
59 hana::unpack(hana::experimental::types<>{}, f),
63 BOOST_HANA_CONSTANT_CHECK(hana::equal(
64 hana::unpack(hana::experimental::types<x<0>>{}, f),
68 BOOST_HANA_CONSTANT_CHECK(hana::equal(
69 hana::unpack(hana::experimental::types<x<0>, x<1>>{}, f),
70 f(hana::type_c<x<0>>, hana::type_c<x<1>>)
73 BOOST_HANA_CONSTANT_CHECK(hana::equal(
74 hana::unpack(hana::experimental::types<x<0>, x<1>, x<2>>{}, f),
75 f(hana::type_c<x<0>>, hana::type_c<x<1>>, hana::type_c<x<2>>)
78 BOOST_HANA_CONSTANT_CHECK(hana::equal(
79 hana::unpack(hana::experimental::types<x<0>, x<1>, x<2>, x<3>>{}, f),
80 f(hana::type_c<x<0>>, hana::type_c<x<1>>, hana::type_c<x<2>>, hana::type_c<x<3>>)