• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/equal.hpp>
7 #include <boost/hana/map.hpp>
8 #include <boost/hana/symmetric_difference.hpp>
9 
10 #include <laws/base.hpp>
11 #include <support/minimal_product.hpp>
12 namespace hana = boost::hana;
13 using hana::test::ct_eq;
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     BOOST_HANA_CONSTANT_CHECK(hana::equal(
27         hana::symmetric_difference(
28             hana::make_map(),
29             hana::make_map()
30         ),
31         hana::make_map()
32     ));
33 
34     BOOST_HANA_CONSTANT_CHECK(hana::equal(
35             hana::symmetric_difference(
36                     hana::make_map(p<1, 1>()),
37                     hana::make_map(p<1, 1>())
38             ),
39             hana::make_map()
40     ));
41 
42     BOOST_HANA_CONSTANT_CHECK(hana::equal(
43             hana::symmetric_difference(
44                     hana::make_map(p<1, 2>()),
45                     hana::make_map(p<2, 4>())
46             ),
47             hana::make_map(p<1, 2>(),
48                            p<2, 4>())
49     ));
50 
51     BOOST_HANA_CONSTANT_CHECK(hana::equal(
52             hana::symmetric_difference(
53                     hana::make_map(p<1, 2>(),
54                                    p<2, 22>()),
55                     hana::make_map(p<2, 4>(),
56                                    p<3, 33>())
57             ),
58             hana::make_map(p<1, 2>(),
59                            p<3, 33>())
60     ));
61 
62     BOOST_HANA_CONSTANT_CHECK(hana::equal(
63             hana::symmetric_difference(
64                     hana::make_map(p<1, 2>(),
65                                    p<2, 22>(),
66                                    p<3, 33>(),
67                                    p<5, 55>(),
68                                    p<8, 88>()),
69                     hana::make_map(p<2, 4>(),
70                                    p<3, 33>(),
71                                    p<4, 44>(),
72                                    p<9, 99>())
73             ),
74             hana::make_map(p<1, 2>(),
75                            p<5, 55>(),
76                            p<8, 88>(),
77                            p<4, 44>(),
78                            p<9, 99>())
79     ));
80 }
81