• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/assert.hpp>
6 #include <boost/hana/contains.hpp>
7 #include <boost/hana/permutations.hpp>
8 #include <boost/hana/set.hpp>
9 #include <boost/hana/transform.hpp>
10 #include <boost/hana/tuple.hpp>
11 #include <boost/hana/unpack.hpp>
12 
13 #include <laws/base.hpp>
14 namespace hana = boost::hana;
15 using hana::test::ct_eq;
16 
17 
main()18 int main() {
19     hana::test::_injection<0> f{};
20 
21     auto check = [=](auto ...xs) {
22         auto arg_perms = hana::permutations(hana::make_tuple(xs...));
23         auto possible_results = hana::transform(arg_perms, [=](auto args) {
24             return hana::unpack(args, f);
25         });
26 
27         BOOST_HANA_CONSTANT_CHECK(hana::contains(
28             possible_results,
29             hana::unpack(hana::make_set(xs...), f)
30         ));
31     };
32 
33     check();
34     check(ct_eq<1>{});
35     check(ct_eq<1>{}, ct_eq<2>{});
36     check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{});
37     check(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}, ct_eq<4>{});
38 }
39