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/contains.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/map.hpp>
9 #include <boost/hana/permutations.hpp>
10
11 #include <laws/base.hpp>
12 #include <support/minimal_product.hpp>
13 #include <support/seq.hpp>
14 namespace hana = boost::hana;
15
16
17 template <int i>
key()18 auto key() { return hana::test::ct_eq<i>{}; }
19
20 template <int i>
val()21 auto val() { return hana::test::ct_eq<-i>{}; }
22
23 template <int i, int j>
p()24 auto p() { return ::minimal_product(key<i>(), val<j>()); }
25
main()26 int main() {
27 constexpr auto list = ::seq;
28
29 BOOST_HANA_CONSTANT_CHECK(hana::equal(
30 hana::values(hana::make_map()),
31 list()
32 ));
33
34 BOOST_HANA_CONSTANT_CHECK(hana::equal(
35 hana::values(hana::make_map(p<1, 1>())),
36 list(val<1>())
37 ));
38
39 BOOST_HANA_CONSTANT_CHECK(hana::contains(
40 hana::permutations(list(val<1>(), val<2>())),
41 hana::values(hana::make_map(p<1, 1>(), p<2, 2>()))
42 ));
43
44 BOOST_HANA_CONSTANT_CHECK(hana::contains(
45 hana::permutations(list(val<1>(), val<2>(), val<3>())),
46 hana::values(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()))
47 ));
48 }
49