]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/string/laws.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / string / laws.cpp
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/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/monoid.hpp>
13 #include <laws/orderable.hpp>
14 #include <laws/searchable.hpp>
15 namespace hana = boost::hana;
16
17
18 int main() {
19 // Comparable and Hashable
20 {
21 auto strings = hana::make_tuple(
22 BOOST_HANA_STRING(""),
23 BOOST_HANA_STRING("a"),
24 BOOST_HANA_STRING("ab"),
25 BOOST_HANA_STRING("abc"),
26 BOOST_HANA_STRING("abcd"),
27 BOOST_HANA_STRING("abcde"),
28 BOOST_HANA_STRING("ba")
29 );
30
31 hana::test::TestComparable<hana::string_tag>{strings};
32 hana::test::TestHashable<hana::string_tag>{strings};
33 }
34
35 // Monoid
36 {
37 auto strings = hana::make_tuple(
38 BOOST_HANA_STRING(""),
39 BOOST_HANA_STRING("a"),
40 BOOST_HANA_STRING("ab"),
41 BOOST_HANA_STRING("abc"),
42 BOOST_HANA_STRING("abcd"),
43 BOOST_HANA_STRING("abcde"),
44 BOOST_HANA_STRING("ba")
45 );
46
47 hana::test::TestMonoid<hana::string_tag>{strings};
48 }
49
50 // Foldable and Iterable
51 {
52 auto strings = hana::make_tuple(
53 BOOST_HANA_STRING(""),
54 BOOST_HANA_STRING("a"),
55 BOOST_HANA_STRING("ab"),
56 BOOST_HANA_STRING("abc"),
57 BOOST_HANA_STRING("abcd"),
58 BOOST_HANA_STRING("abcde"),
59 BOOST_HANA_STRING("ba"),
60 BOOST_HANA_STRING("afcd")
61 );
62
63 hana::test::TestFoldable<hana::string_tag>{strings};
64 hana::test::TestIterable<hana::string_tag>{strings};
65 }
66
67 // Orderable
68 {
69 auto strings = hana::make_tuple(
70 BOOST_HANA_STRING(""),
71 BOOST_HANA_STRING("a"),
72 BOOST_HANA_STRING("ab"),
73 BOOST_HANA_STRING("abc"),
74 BOOST_HANA_STRING("ba"),
75 BOOST_HANA_STRING("abd")
76 );
77
78 hana::test::TestOrderable<hana::string_tag>{strings};
79 }
80
81 // Searchable
82 {
83 auto keys = hana::tuple_c<char, 'a', 'f'>;
84 auto strings = hana::make_tuple(
85 BOOST_HANA_STRING(""),
86 BOOST_HANA_STRING("a"),
87 BOOST_HANA_STRING("ab"),
88 BOOST_HANA_STRING("abcd"),
89 BOOST_HANA_STRING("ba"),
90 BOOST_HANA_STRING("afcd")
91 );
92
93 hana::test::TestSearchable<hana::string_tag>{strings, keys};
94 }
95 }