]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/set/to.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)
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>
12 #include <laws/base.hpp>
13 #include <support/seq.hpp>
14 namespace hana
= boost::hana
;
15 using hana::test::ct_eq
;
19 auto sequence
= ::seq
;
20 auto foldable
= ::seq
;
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
...))
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>{});
40 BOOST_HANA_CONSTANT_CHECK(hana::equal(
41 hana::to
<hana::set_tag
>(foldable()),
45 BOOST_HANA_CONSTANT_CHECK(hana::equal(
46 hana::to
<hana::set_tag
>(foldable(ct_eq
<1>{})),
47 hana::make_set(ct_eq
<1>{})
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>{})
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>{})
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>{})
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>{})
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>{})
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>{})
77 // to_set == to<set_tag>
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>{}))