]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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 | #include <boost/hana/string.hpp> | |
10 | ||
11 | #include <string> | |
12 | namespace hana = boost::hana; | |
b32b8144 FG |
13 | |
14 | ||
92f5a8d4 TL |
15 | static auto m1 = hana::make_map( |
16 | hana::make_pair(BOOST_HANA_STRING("key1"), hana::type_c<std::string>), | |
17 | hana::make_pair(BOOST_HANA_STRING("key2"), hana::type_c<std::string>) | |
b32b8144 FG |
18 | ); |
19 | ||
92f5a8d4 TL |
20 | static auto m2 = hana::make_map( |
21 | hana::make_pair(BOOST_HANA_STRING("key3"), hana::type_c<std::string>), | |
22 | hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<std::string>), | |
23 | hana::make_pair(BOOST_HANA_STRING("key5"), hana::type_c<std::string>) | |
b32b8144 FG |
24 | ); |
25 | ||
92f5a8d4 TL |
26 | static auto m3 = hana::make_map( |
27 | hana::make_pair(BOOST_HANA_STRING("key1"), hana::type_c<std::string>), | |
28 | hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<int>), | |
29 | hana::make_pair(BOOST_HANA_STRING("key2"), hana::type_c<long long>) | |
b32b8144 FG |
30 | ); |
31 | ||
32 | int main() { | |
33 | BOOST_HANA_CONSTANT_CHECK(hana::difference(m1, m2) == m1); | |
34 | ||
35 | BOOST_HANA_CONSTANT_CHECK(hana::difference(m1, m3) == hana::make_map()); | |
36 | ||
37 | BOOST_HANA_CONSTANT_CHECK(hana::difference(m3, m1) == hana::make_map( | |
92f5a8d4 | 38 | hana::make_pair(BOOST_HANA_STRING("key4"), hana::type_c<int>) |
b32b8144 FG |
39 | )); |
40 | ||
41 | BOOST_HANA_CONSTANT_CHECK(hana::difference(m2, m3) == hana::make_map( | |
92f5a8d4 TL |
42 | hana::make_pair(BOOST_HANA_STRING("key3"), hana::type_c<std::string>), |
43 | hana::make_pair(BOOST_HANA_STRING("key5"), hana::type_c<std::string>) | |
b32b8144 FG |
44 | )); |
45 | } |