]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/set/to.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / set / to.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/contains.hpp>
7#include <boost/hana/core/to.hpp>
8#include <boost/hana/equal.hpp>
9#include <boost/hana/permutations.hpp>
10#include <boost/hana/set.hpp>
11
12#include <laws/base.hpp>
13#include <support/seq.hpp>
14namespace hana = boost::hana;
15using hana::test::ct_eq;
16
17
18int main() {
19 auto sequence = ::seq;
20 auto foldable = ::seq;
21 using S = ::Seq;
22
23 // Set -> Sequence
24 {
25 auto check = [=](auto ...xs) {
26 BOOST_HANA_CONSTANT_CHECK(hana::contains(
27 hana::permutations(sequence(xs...)),
28 hana::to<S>(hana::make_set(xs...))
29 ));
30 };
31 check();
32 check(ct_eq<1>{});
33 check(ct_eq<1>{}, ct_eq<2>{});
34 check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{});
35 check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{});
36 }
37
38 // Foldable -> Set
39 {
40 BOOST_HANA_CONSTANT_CHECK(hana::equal(
41 hana::to<hana::set_tag>(foldable()),
42 hana::make_set()
43 ));
44
45 BOOST_HANA_CONSTANT_CHECK(hana::equal(
46 hana::to<hana::set_tag>(foldable(ct_eq<1>{})),
47 hana::make_set(ct_eq<1>{})
48 ));
49 BOOST_HANA_CONSTANT_CHECK(hana::equal(
50 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<1>{})),
51 hana::make_set(ct_eq<1>{})
52 ));
53
54 BOOST_HANA_CONSTANT_CHECK(hana::equal(
55 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{})),
56 hana::make_set(ct_eq<1>{}, ct_eq<2>{})
57 ));
58 BOOST_HANA_CONSTANT_CHECK(hana::equal(
59 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<1>{})),
60 hana::make_set(ct_eq<1>{}, ct_eq<2>{})
61 ));
62 BOOST_HANA_CONSTANT_CHECK(hana::equal(
63 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<2>{})),
64 hana::make_set(ct_eq<1>{}, ct_eq<2>{})
65 ));
66
67 BOOST_HANA_CONSTANT_CHECK(hana::equal(
68 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})),
69 hana::make_set(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
70 ));
71 BOOST_HANA_CONSTANT_CHECK(hana::equal(
72 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{})),
73 hana::make_set(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
74 ));
75 }
76
77 // to_set == to<set_tag>
78 {
79 BOOST_HANA_CONSTANT_CHECK(hana::equal(
80 hana::to_set(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{})),
81 hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{}))
82 ));
83 }
84}