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/map.hpp>
6 #include <boost/hana/tuple.hpp>
7
8 #include <laws/base.hpp>
9 #include <laws/comparable.hpp>
10 #include <laws/foldable.hpp>
11 #include <laws/searchable.hpp>
12 #include <support/minimal_product.hpp>
13 namespace hana = boost::hana;
14
15
16 template <int i>
key()17 auto key() { return hana::test::ct_eq<i>{}; }
18
19 template <int i>
val()20 auto val() { return hana::test::ct_eq<-i>{}; }
21
22 template <int i, int j>
p()23 auto p() { return ::minimal_product(key<i>(), val<j>()); }
24
main()25 int main() {
26 auto maps = hana::make_tuple(
27 hana::make_map(),
28 hana::make_map(p<1, 1>()),
29 hana::make_map(p<1, 2>()),
30 hana::make_map(p<1, 1>(), p<2, 2>()),
31 hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
32 );
33
34 hana::test::TestComparable<hana::map_tag>{maps};
35 hana::test::TestSearchable<hana::map_tag>{maps, hana::make_tuple(key<1>(), key<4>())};
36 hana::test::TestFoldable<hana::map_tag>{maps};
37 }
38