summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/test/set
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/hana/test/set
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/hana/test/set')
-rw-r--r--src/boost/libs/hana/test/set/any_of.cpp43
-rw-r--r--src/boost/libs/hana/test/set/cnstr.copy.cpp52
-rw-r--r--src/boost/libs/hana/test/set/cnstr.default.cpp77
-rw-r--r--src/boost/libs/hana/test/set/cnstr.move.cpp63
-rw-r--r--src/boost/libs/hana/test/set/cnstr.trap.cpp67
-rw-r--r--src/boost/libs/hana/test/set/difference.cpp67
-rw-r--r--src/boost/libs/hana/test/set/equal.cpp56
-rw-r--r--src/boost/libs/hana/test/set/erase_key.cpp62
-rw-r--r--src/boost/libs/hana/test/set/find_if.cpp50
-rw-r--r--src/boost/libs/hana/test/set/insert.cpp45
-rw-r--r--src/boost/libs/hana/test/set/intersection.cpp90
-rw-r--r--src/boost/libs/hana/test/set/is_subset.cpp45
-rw-r--r--src/boost/libs/hana/test/set/laws.cpp33
-rw-r--r--src/boost/libs/hana/test/set/make.cpp34
-rw-r--r--src/boost/libs/hana/test/set/symmetric_difference.cpp67
-rw-r--r--src/boost/libs/hana/test/set/to.cpp84
-rw-r--r--src/boost/libs/hana/test/set/union.cpp84
-rw-r--r--src/boost/libs/hana/test/set/unpack.cpp38
18 files changed, 1057 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/set/any_of.cpp b/src/boost/libs/hana/test/set/any_of.cpp
new file mode 100644
index 000000000..1f092cbeb
--- /dev/null
+++ b/src/boost/libs/hana/test/set/any_of.cpp
@@ -0,0 +1,43 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/any_of.hpp>
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_set(),
+ hana::equal.to(ct_eq<1>{})
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_set(ct_eq<1>{}),
+ hana::equal.to(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_set(ct_eq<1>{}),
+ hana::equal.to(ct_eq<2>{})
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
+ hana::equal.to(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
+ hana::equal.to(ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{}),
+ hana::equal.to(ct_eq<3>{})
+ )));
+}
diff --git a/src/boost/libs/hana/test/set/cnstr.copy.cpp b/src/boost/libs/hana/test/set/cnstr.copy.cpp
new file mode 100644
index 000000000..a3fa27571
--- /dev/null
+++ b/src/boost/libs/hana/test/set/cnstr.copy.cpp
@@ -0,0 +1,52 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/type.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ {
+ auto t0 = hana::make_set();
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_explicit;
+ (void)t_implicit;
+ }
+ {
+ auto t0 = hana::make_set(hana::int_c<2>);
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_set(hana::int_c<2>, hana::int_c<3>);
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_set(hana::int_c<2>, hana::int_c<3>, hana::type_c<int>);
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ constexpr auto t0 = hana::make_set(hana::int_c<2>, hana::int_c<3>, hana::type_c<int>);
+ constexpr auto t_implicit = t0;
+ constexpr auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+}
diff --git a/src/boost/libs/hana/test/set/cnstr.default.cpp b/src/boost/libs/hana/test/set/cnstr.default.cpp
new file mode 100644
index 000000000..bc5ee91db
--- /dev/null
+++ b/src/boost/libs/hana/test/set/cnstr.default.cpp
@@ -0,0 +1,77 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/type.hpp>
+
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+template <int i>
+struct NoDefault {
+ NoDefault() = delete;
+ NoDefault(NoDefault const&) = default;
+ constexpr explicit NoDefault(int) { }
+};
+
+template <int i, int j>
+auto operator==(NoDefault<i> const&, NoDefault<j> const&) { return hana::bool_<i == j>{}; }
+template <int i, int j>
+auto operator!=(NoDefault<i> const&, NoDefault<j> const&) { return hana::bool_<i != j>{}; }
+
+template <int i>
+struct Default {
+ Default() = default;
+ Default(Default const&) = default;
+ constexpr explicit Default(int) { }
+};
+
+template <int i, int j>
+auto operator==(Default<i> const&, Default<j> const&) { return hana::bool_<i == j>{}; }
+template <int i, int j>
+auto operator!=(Default<i> const&, Default<j> const&) { return hana::bool_<i != j>{}; }
+
+namespace boost { namespace hana {
+ template <int i>
+ struct hash_impl<NoDefault<i>> {
+ static constexpr auto apply(NoDefault<i> const&)
+ { return hana::type_c<NoDefault<i>>; };
+ };
+
+ template <int i>
+ struct hash_impl<Default<i>> {
+ static constexpr auto apply(Default<i> const&)
+ { return hana::type_c<Default<i>>; };
+ };
+}}
+
+int main() {
+ {
+ auto set0 = hana::make_set();
+ static_assert(std::is_default_constructible<decltype(set0)>{}, "");
+
+ auto set1 = hana::make_set(Default<0>(int{}));
+ static_assert(std::is_default_constructible<decltype(set1)>{}, "");
+
+ auto set2 = hana::make_set(Default<0>(int{}), Default<1>(int{}));
+ static_assert(std::is_default_constructible<decltype(set2)>{}, "");
+
+ auto set3 = hana::make_set(Default<0>(int{}), NoDefault<1>(int{}), Default<2>(int{}));
+ static_assert(!std::is_default_constructible<decltype(set3)>{}, "");
+ }
+
+ {
+ auto set1 = hana::make_set(NoDefault<0>(int{}));
+ static_assert(!std::is_default_constructible<decltype(set1)>{}, "");
+
+ auto set2 = hana::make_set(NoDefault<0>(int{}), NoDefault<1>(int{}));
+ static_assert(!std::is_default_constructible<decltype(set2)>{}, "");
+
+ auto set3 = hana::make_set(NoDefault<0>(int{}), NoDefault<1>(int{}), NoDefault<2>(int{}));
+ static_assert(!std::is_default_constructible<decltype(set3)>{}, "");
+ }
+} \ No newline at end of file
diff --git a/src/boost/libs/hana/test/set/cnstr.move.cpp b/src/boost/libs/hana/test/set/cnstr.move.cpp
new file mode 100644
index 000000000..e1a985111
--- /dev/null
+++ b/src/boost/libs/hana/test/set/cnstr.move.cpp
@@ -0,0 +1,63 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/type.hpp>
+
+#include <support/constexpr_move_only.hpp>
+#include <support/tracked_move_only.hpp>
+
+#include <utility>
+namespace hana = boost::hana;
+
+
+constexpr bool in_constexpr_context() {
+ auto t0 = hana::make_set(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<3>{});
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ return true;
+}
+
+static_assert(in_constexpr_context(), "");
+
+
+int main() {
+ {
+ auto t0 = hana::make_set();
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_explicit;
+ (void)t_implicit;
+ }
+ {
+ auto t0 = hana::make_set(TrackedMoveOnly<1>{});
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{});
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{}, TrackedMoveOnly<3>{});
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+}
diff --git a/src/boost/libs/hana/test/set/cnstr.trap.cpp b/src/boost/libs/hana/test/set/cnstr.trap.cpp
new file mode 100644
index 000000000..fd95b15e7
--- /dev/null
+++ b/src/boost/libs/hana/test/set/cnstr.trap.cpp
@@ -0,0 +1,67 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/detail/wrong.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/type.hpp>
+
+#include <utility>
+namespace hana = boost::hana;
+
+
+// This test makes sure that we do not instantiate rogue constructors when
+// doing copies and moves
+
+template <int i>
+struct Trap {
+ Trap() = default;
+ Trap(Trap const&) = default;
+#ifndef BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654
+ Trap(Trap&) = default;
+#endif
+ Trap(Trap&&) = default;
+
+ template <typename X>
+ Trap(X&&) {
+ static_assert(hana::detail::wrong<X>{},
+ "this constructor must not be instantiated");
+ }
+};
+
+template <int i, int j>
+constexpr auto operator==(Trap<i> const&, Trap<j> const&)
+{ return hana::bool_c<i == j>; }
+
+template <int i, int j>
+constexpr auto operator!=(Trap<i> const&, Trap<j> const&)
+{ return hana::bool_c<i != j>; }
+
+namespace boost { namespace hana {
+ template <int i>
+ struct hash_impl<Trap<i>> {
+ static constexpr auto apply(Trap<i> const&)
+ { return hana::type_c<Trap<i>>; };
+ };
+}}
+
+int main() {
+ {
+ auto expr = hana::make_set(Trap<0>{});
+ auto implicit_copy = expr;
+ decltype(expr) explicit_copy(expr);
+
+ (void)implicit_copy;
+ (void)explicit_copy;
+ }
+ {
+ auto expr = hana::make_set(Trap<0>{});
+ auto implicit_move = std::move(expr);
+ decltype(expr) explicit_move(std::move(implicit_move));
+
+ (void)implicit_move;
+ (void)explicit_move;
+ }
+}
diff --git a/src/boost/libs/hana/test/set/difference.cpp b/src/boost/libs/hana/test/set/difference.cpp
new file mode 100644
index 000000000..fdb7c91c0
--- /dev/null
+++ b/src/boost/libs/hana/test/set/difference.cpp
@@ -0,0 +1,67 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/difference.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(),
+ hana::make_set()
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<3>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<3>{}, ct_eq<2>{})
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/equal.cpp b/src/boost/libs/hana/test/set/equal.cpp
new file mode 100644
index 000000000..d0c350734
--- /dev/null
+++ b/src/boost/libs/hana/test/set/equal.cpp
@@ -0,0 +1,56 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/core/to.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/for_each.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/not_equal.hpp> // for operator !=
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ auto check = [](auto ...keys) {
+ auto keys_set = hana::make_set(keys...);
+ auto keys_tuple = hana::make_tuple(keys...);
+ auto possible_arrangements = hana::permutations(keys_tuple);
+
+ hana::for_each(possible_arrangements, [&](auto perm) {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_set(perm),
+ keys_set
+ ));
+ });
+
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ keys_set,
+ hana::make_set(keys..., ct_eq<999>{})
+ )));
+ };
+
+ check();
+ check(ct_eq<0>{});
+ check(ct_eq<0>{}, ct_eq<1>{});
+ check(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{});
+
+ // check operators
+ BOOST_HANA_CONSTANT_CHECK(
+ hana::make_set(ct_eq<0>{})
+ ==
+ hana::make_set(ct_eq<0>{})
+ );
+
+ BOOST_HANA_CONSTANT_CHECK(
+ hana::make_set(ct_eq<0>{})
+ !=
+ hana::make_set(ct_eq<1>{})
+ );
+}
diff --git a/src/boost/libs/hana/test/set/erase_key.cpp b/src/boost/libs/hana/test/set/erase_key.cpp
new file mode 100644
index 000000000..4103144a2
--- /dev/null
+++ b/src/boost/libs/hana/test/set/erase_key.cpp
@@ -0,0 +1,62 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/erase_key.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+struct undefined { };
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(), undefined{}),
+ hana::make_set()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}), ct_eq<0>{}),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}), ct_eq<99>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}), ct_eq<0>{}),
+ hana::make_set(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}), ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}), ct_eq<99>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), ct_eq<0>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), ct_eq<2>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), ct_eq<99>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/find_if.cpp b/src/boost/libs/hana/test/set/find_if.cpp
new file mode 100644
index 000000000..190d311e1
--- /dev/null
+++ b/src/boost/libs/hana/test/set/find_if.cpp
@@ -0,0 +1,50 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/find_if.hpp>
+#include <boost/hana/optional.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(), hana::equal.to(ct_eq<1>{})),
+ hana::nothing
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(ct_eq<1>{}), hana::equal.to(ct_eq<1>{})),
+ hana::just(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(ct_eq<1>{}), hana::equal.to(ct_eq<2>{})),
+ hana::nothing
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<1>{})),
+ hana::just(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<2>{})),
+ hana::just(ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<3>{})),
+ hana::nothing
+ ));
+
+ // find with operators
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make_set(ct_eq<1>{})[ct_eq<1>{}],
+ ct_eq<1>{}
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/insert.cpp b/src/boost/libs/hana/test/set/insert.cpp
new file mode 100644
index 000000000..daa50be00
--- /dev/null
+++ b/src/boost/libs/hana/test/set/insert.cpp
@@ -0,0 +1,45 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/insert.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(), ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(ct_eq<0>{}), ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(ct_eq<0>{}), ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(ct_eq<0>{}, ct_eq<1>{}), ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(ct_eq<0>{}, ct_eq<1>{}), ct_eq<2>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), ct_eq<3>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/intersection.cpp b/src/boost/libs/hana/test/set/intersection.cpp
new file mode 100644
index 000000000..bb2a2d382
--- /dev/null
+++ b/src/boost/libs/hana/test/set/intersection.cpp
@@ -0,0 +1,90 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/intersection.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(),
+ hana::make_set()
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set()
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(),
+ hana::make_set(ct_eq<0>{})
+ ),
+ hana::make_set()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<2>{}, ct_eq<3>{})
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{})
+ ),
+ hana::make_set(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<0>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<0>{}, ct_eq<4>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<0>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<4>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/is_subset.cpp b/src/boost/libs/hana/test/set/is_subset.cpp
new file mode 100644
index 000000000..7db106aac
--- /dev/null
+++ b/src/boost/libs/hana/test/set/is_subset.cpp
@@ -0,0 +1,45 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/is_subset.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_set(),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_subset(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<3>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ )));
+}
diff --git a/src/boost/libs/hana/test/set/laws.cpp b/src/boost/libs/hana/test/set/laws.cpp
new file mode 100644
index 000000000..0741ad782
--- /dev/null
+++ b/src/boost/libs/hana/test/set/laws.cpp
@@ -0,0 +1,33 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/set.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/base.hpp>
+#include <laws/comparable.hpp>
+#include <laws/foldable.hpp>
+#include <laws/searchable.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ auto eqs = hana::make_tuple(
+ hana::make_set(),
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ );
+
+ auto keys = hana::make_tuple(
+ ct_eq<2>{},
+ ct_eq<3>{}
+ );
+
+ hana::test::TestComparable<hana::set_tag>{eqs};
+ hana::test::TestSearchable<hana::set_tag>{eqs, keys};
+ hana::test::TestFoldable<hana::set_tag>{eqs};
+}
diff --git a/src/boost/libs/hana/test/set/make.cpp b/src/boost/libs/hana/test/set/make.cpp
new file mode 100644
index 000000000..2ec86f7fa
--- /dev/null
+++ b/src/boost/libs/hana/test/set/make.cpp
@@ -0,0 +1,34 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make<hana::set_tag>(),
+ hana::make_set()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make<hana::set_tag>(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make<hana::set_tag>(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make<hana::set_tag>(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/symmetric_difference.cpp b/src/boost/libs/hana/test/set/symmetric_difference.cpp
new file mode 100644
index 000000000..ac11ad2dd
--- /dev/null
+++ b/src/boost/libs/hana/test/set/symmetric_difference.cpp
@@ -0,0 +1,67 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/symmetric_difference.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(),
+ hana::make_set()
+ ),
+ hana::make_set()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<3>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{}, ct_eq<3>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<3>{}, ct_eq<2>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<3>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/to.cpp b/src/boost/libs/hana/test/set/to.cpp
new file mode 100644
index 000000000..c2cc1a5de
--- /dev/null
+++ b/src/boost/libs/hana/test/set/to.cpp
@@ -0,0 +1,84 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/core/to.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/set.hpp>
+
+#include <laws/base.hpp>
+#include <support/seq.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ auto sequence = ::seq;
+ auto foldable = ::seq;
+ using S = ::Seq;
+
+ // Set -> Sequence
+ {
+ auto check = [=](auto ...xs) {
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(sequence(xs...)),
+ hana::to<S>(hana::make_set(xs...))
+ ));
+ };
+ check();
+ check(ct_eq<1>{});
+ check(ct_eq<1>{}, ct_eq<2>{});
+ check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{});
+ check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{});
+ }
+
+ // Foldable -> Set
+ {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable()),
+ hana::make_set()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{})),
+ hana::make_set(ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<1>{})),
+ hana::make_set(ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{})),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<1>{})),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<2>{})),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{})),
+ hana::make_set(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
+ ));
+ }
+
+ // to_set == to<set_tag>
+ {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_set(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{})),
+ hana::to<hana::set_tag>(foldable(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<2>{}, ct_eq<1>{}))
+ ));
+ }
+}
diff --git a/src/boost/libs/hana/test/set/union.cpp b/src/boost/libs/hana/test/set/union.cpp
new file mode 100644
index 000000000..5316b1b28
--- /dev/null
+++ b/src/boost/libs/hana/test/set/union.cpp
@@ -0,0 +1,84 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/union.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(),
+ hana::make_set()
+ ),
+ hana::make_set()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set()
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(),
+ hana::make_set(ct_eq<0>{})
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<0>{})
+ ),
+ hana::make_set(ct_eq<0>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<0>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{}),
+ hana::make_set(ct_eq<1>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_set(ct_eq<0>{}, ct_eq<2>{}, ct_eq<5>{}),
+ hana::make_set(ct_eq<1>{}, ct_eq<3>{}, ct_eq<4>{})
+ ),
+ hana::make_set(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{}, ct_eq<5>{})
+ ));
+}
diff --git a/src/boost/libs/hana/test/set/unpack.cpp b/src/boost/libs/hana/test/set/unpack.cpp
new file mode 100644
index 000000000..4412dd96b
--- /dev/null
+++ b/src/boost/libs/hana/test/set/unpack.cpp
@@ -0,0 +1,38 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/set.hpp>
+#include <boost/hana/transform.hpp>
+#include <boost/hana/tuple.hpp>
+#include <boost/hana/unpack.hpp>
+
+#include <laws/base.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+int main() {
+ hana::test::_injection<0> f{};
+
+ auto check = [=](auto ...xs) {
+ auto arg_perms = hana::permutations(hana::make_tuple(xs...));
+ auto possible_results = hana::transform(arg_perms, [=](auto args) {
+ return hana::unpack(args, f);
+ });
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ possible_results,
+ hana::unpack(hana::make_set(xs...), f)
+ ));
+ };
+
+ check();
+ check(ct_eq<1>{});
+ check(ct_eq<1>{}, ct_eq<2>{});
+ check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{});
+ check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{});
+}