• 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/equal.hpp>
7 #include <boost/hana/functional/reverse_partial.hpp>
8 
9 #include <laws/base.hpp>
10 namespace hana = boost::hana;
11 using hana::test::ct_eq;
12 
13 
main()14 int main() {
15     constexpr auto rp = hana::reverse_partial;
16     hana::test::_injection<0> f{};
17 
18     BOOST_HANA_CONSTANT_CHECK(hana::equal(
19         rp(f)(),
20         f()
21     ));
22     BOOST_HANA_CONSTANT_CHECK(hana::equal(
23         rp(f)(ct_eq<1>{}),
24         f(ct_eq<1>{})
25     ));
26     BOOST_HANA_CONSTANT_CHECK(hana::equal(
27         rp(f)(ct_eq<1>{}, ct_eq<2>{}),
28         f(ct_eq<1>{}, ct_eq<2>{})
29     ));
30     BOOST_HANA_CONSTANT_CHECK(hana::equal(
31         rp(f)(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}),
32         f(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
33     ));
34 
35     BOOST_HANA_CONSTANT_CHECK(hana::equal(
36         rp(f, ct_eq<1>{})(),
37         f(ct_eq<1>{})
38     ));
39     BOOST_HANA_CONSTANT_CHECK(hana::equal(
40         rp(f, ct_eq<1>{})(ct_eq<2>{}),
41         f(ct_eq<2>{}, ct_eq<1>{})
42     ));
43     BOOST_HANA_CONSTANT_CHECK(hana::equal(
44         rp(f, ct_eq<1>{})(ct_eq<2>{}, ct_eq<3>{}),
45         f(ct_eq<2>{}, ct_eq<3>{}, ct_eq<1>{})
46     ));
47 
48     BOOST_HANA_CONSTANT_CHECK(hana::equal(
49         rp(f, ct_eq<1>{}, ct_eq<2>{})(),
50         f(ct_eq<1>{}, ct_eq<2>{})
51     ));
52     BOOST_HANA_CONSTANT_CHECK(hana::equal(
53         rp(f, ct_eq<1>{}, ct_eq<2>{})(ct_eq<3>{}),
54         f(ct_eq<3>{}, ct_eq<1>{}, ct_eq<2>{})
55     ));
56     BOOST_HANA_CONSTANT_CHECK(hana::equal(
57         rp(f, ct_eq<1>{}, ct_eq<2>{})(ct_eq<3>{}, ct_eq<4>{}),
58         f(ct_eq<3>{}, ct_eq<4>{}, ct_eq<1>{}, ct_eq<2>{})
59     ));
60 
61     BOOST_HANA_CONSTANT_CHECK(hana::equal(
62         rp(f, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})(),
63         f(ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
64     ));
65 }
66