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/difference.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/map.hpp>
9
10 #include <laws/base.hpp>
11 #include <support/minimal_product.hpp>
12 namespace hana = boost::hana;
13
14
15 template <int i>
key()16 auto key() { return hana::test::ct_eq<i>{}; }
17
18 template <int i>
val()19 auto val() { return hana::test::ct_eq<-i>{}; }
20
21 template <int i, int j>
p()22 auto p() { return ::minimal_product(key<i>(), val<j>()); }
23
main()24 int main() {
25 BOOST_HANA_CONSTANT_CHECK(hana::equal(
26 hana::difference(
27 hana::make_map(),
28 hana::make_map()
29 ),
30 hana::make_map()
31 ));
32
33 BOOST_HANA_CONSTANT_CHECK(hana::equal(
34 hana::difference(
35 hana::make_map(p<1, 1>()),
36 hana::make_map()
37 ),
38 hana::make_map(p<1, 1>())
39 ));
40
41 BOOST_HANA_CONSTANT_CHECK(hana::equal(
42 hana::difference(
43 hana::make_map(p<1, 1>()),
44 hana::make_map(p<2, 2>())
45 ),
46 hana::make_map(p<1, 1>())
47 ));
48
49 BOOST_HANA_CONSTANT_CHECK(hana::equal(
50 hana::difference(
51 hana::make_map(p<1, 1>()),
52 hana::make_map(p<1, 2>())
53 ),
54 hana::make_map()
55 ));
56
57 BOOST_HANA_CONSTANT_CHECK(hana::equal(
58 hana::difference(
59 hana::make_map(p<1, 1>(),
60 p<2, 2>(),
61 p<3, 3>()),
62 hana::make_map(p<2, 2>(),
63 p<4, 4>())
64 ),
65 hana::make_map(p<1, 1>(),
66 p<3, 3>())
67 ));
68
69 BOOST_HANA_CONSTANT_CHECK(hana::equal(
70 hana::difference(
71 hana::make_map(p<1, 1>(),
72 p<2, 2>()),
73 hana::make_map(p<2, 3>(),
74 p<1, 4>())
75 ),
76 hana::make_map()
77 ));
78
79 BOOST_HANA_CONSTANT_CHECK(hana::equal(
80 hana::difference(
81 hana::make_map(p<1, 1>(),
82 p<2, 2>(),
83 p<3, 3>(),
84 p<4, 4>(),
85 p<5, 5>(),
86 p<6, 6>(),
87 p<7, 7>(),
88 p<8, 8>(),
89 p<9, 9>(),
90 p<10, 10>()),
91 hana::make_map(p<0, 2>(),
92 p<2, 4>(),
93 p<3, 6>(),
94 p<4, 8>(),
95 p<5, 10>(),
96 p<20, 30>())
97 ),
98 hana::make_map(p<1, 1>(),
99 p<6, 6>(),
100 p<7, 7>(),
101 p<8, 8>(),
102 p<9, 9>(),
103 p<10, 10>())
104 ));
105
106 }
107