]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/string/laws.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / test / string / laws.cpp
1 // Copyright Louis Dionne 2013-2016
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/string.hpp>
6 #include <boost/hana/tuple.hpp>
7
8 #include <laws/comparable.hpp>
9 #include <laws/foldable.hpp>
10 #include <laws/hashable.hpp>
11 #include <laws/iterable.hpp>
12 #include <laws/orderable.hpp>
13 #include <laws/searchable.hpp>
14 namespace hana = boost::hana;
15
16
17 int main() {
18 // Comparable and Hashable
19 {
20 auto strings = hana::make_tuple(
21 BOOST_HANA_STRING(""),
22 BOOST_HANA_STRING("a"),
23 BOOST_HANA_STRING("ab"),
24 BOOST_HANA_STRING("abc"),
25 BOOST_HANA_STRING("abcd"),
26 BOOST_HANA_STRING("abcde"),
27 BOOST_HANA_STRING("ba")
28 );
29
30 hana::test::TestComparable<hana::string_tag>{strings};
31 hana::test::TestHashable<hana::string_tag>{strings};
32 }
33
34 // Foldable and Iterable
35 {
36 auto strings = hana::make_tuple(
37 BOOST_HANA_STRING(""),
38 BOOST_HANA_STRING("a"),
39 BOOST_HANA_STRING("ab"),
40 BOOST_HANA_STRING("abc"),
41 BOOST_HANA_STRING("abcd"),
42 BOOST_HANA_STRING("abcde"),
43 BOOST_HANA_STRING("ba"),
44 BOOST_HANA_STRING("afcd")
45 );
46
47 hana::test::TestFoldable<hana::string_tag>{strings};
48 hana::test::TestIterable<hana::string_tag>{strings};
49 }
50
51 // Orderable
52 {
53 auto strings = hana::make_tuple(
54 BOOST_HANA_STRING(""),
55 BOOST_HANA_STRING("a"),
56 BOOST_HANA_STRING("ab"),
57 BOOST_HANA_STRING("abc"),
58 BOOST_HANA_STRING("ba"),
59 BOOST_HANA_STRING("abd")
60 );
61
62 hana::test::TestOrderable<hana::string_tag>{strings};
63 }
64
65 // Searchable
66 {
67 auto keys = hana::tuple_c<char, 'a', 'f'>;
68 auto strings = hana::make_tuple(
69 BOOST_HANA_STRING(""),
70 BOOST_HANA_STRING("a"),
71 BOOST_HANA_STRING("ab"),
72 BOOST_HANA_STRING("abcd"),
73 BOOST_HANA_STRING("ba"),
74 BOOST_HANA_STRING("afcd")
75 );
76
77 hana::test::TestSearchable<hana::string_tag>{strings, keys};
78 }
79 }