• 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/intersection.hpp>
8 #include <boost/hana/set.hpp>
9 
10 #include <laws/base.hpp>
11 namespace hana = boost::hana;
12 using hana::test::ct_eq;
13 
14 
main()15 int main() {
16     BOOST_HANA_CONSTANT_CHECK(hana::equal(
17         hana::intersection(
18             hana::make_set(),
19             hana::make_set()
20         ),
21         hana::make_set()
22     ));
23     BOOST_HANA_CONSTANT_CHECK(hana::equal(
24         hana::intersection(
25             hana::make_set(ct_eq<0>{}),
26             hana::make_set()
27         ),
28         hana::make_set()
29     ));
30     BOOST_HANA_CONSTANT_CHECK(hana::equal(
31         hana::intersection(
32             hana::make_set(),
33             hana::make_set(ct_eq<0>{})
34         ),
35         hana::make_set()
36     ));
37 
38     BOOST_HANA_CONSTANT_CHECK(hana::equal(
39         hana::intersection(
40             hana::make_set(ct_eq<0>{}),
41             hana::make_set(ct_eq<1>{})
42         ),
43         hana::make_set()
44     ));
45     BOOST_HANA_CONSTANT_CHECK(hana::equal(
46         hana::intersection(
47             hana::make_set(ct_eq<0>{}),
48             hana::make_set(ct_eq<0>{})
49         ),
50         hana::make_set(ct_eq<0>{})
51     ));
52 
53     BOOST_HANA_CONSTANT_CHECK(hana::equal(
54         hana::intersection(
55             hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
56             hana::make_set(ct_eq<2>{}, ct_eq<3>{})
57         ),
58         hana::make_set()
59     ));
60     BOOST_HANA_CONSTANT_CHECK(hana::equal(
61         hana::intersection(
62             hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
63             hana::make_set(ct_eq<1>{}, ct_eq<2>{})
64         ),
65         hana::make_set(ct_eq<1>{})
66     ));
67     BOOST_HANA_CONSTANT_CHECK(hana::equal(
68         hana::intersection(
69             hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
70             hana::make_set(ct_eq<1>{}, ct_eq<0>{})
71         ),
72         hana::make_set(ct_eq<0>{}, ct_eq<1>{})
73     ));
74 
75     BOOST_HANA_CONSTANT_CHECK(hana::equal(
76         hana::intersection(
77             hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}),
78             hana::make_set(ct_eq<1>{}, ct_eq<0>{}, ct_eq<4>{})
79         ),
80         hana::make_set(ct_eq<0>{}, ct_eq<1>{})
81     ));
82 
83     BOOST_HANA_CONSTANT_CHECK(hana::equal(
84         hana::intersection(
85             hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}),
86             hana::make_set(ct_eq<1>{}, ct_eq<0>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<4>{})
87         ),
88         hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
89     ));
90 }
91