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/assert.hpp>
6 #include <boost/hana/concept/struct.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/integral_constant.hpp>
9 #include <boost/hana/unpack.hpp>
10
11 #include "minimal_struct.hpp"
12 #include <laws/base.hpp>
13 #include <support/minimal_product.hpp>
14 namespace hana = boost::hana;
15 using hana::test::ct_eq;
16
17
main()18 int main() {
19 constexpr auto pair = ::minimal_product;
20 hana::test::_injection<0> f{};
21
22 BOOST_HANA_CONSTANT_CHECK(hana::equal(
23 hana::unpack(obj(), f),
24 f()
25 ));
26
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::unpack(obj(ct_eq<0>{}), f),
29 f(pair(hana::int_c<0>, ct_eq<0>{}))
30 ));
31
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::unpack(obj(ct_eq<0>{}, ct_eq<1>{}), f),
34 f(pair(hana::int_c<0>, ct_eq<0>{}),
35 pair(hana::int_c<1>, ct_eq<1>{}))
36 ));
37
38 BOOST_HANA_CONSTANT_CHECK(hana::equal(
39 hana::unpack(obj(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), f),
40 f(pair(hana::int_c<0>, ct_eq<0>{}),
41 pair(hana::int_c<1>, ct_eq<1>{}),
42 pair(hana::int_c<2>, ct_eq<2>{}))
43 ));
44 }
45