1 // Copyright Louis Dionne 2013-2016
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 #ifndef BOOST_HANA_TEST_AUTO_REVERSE_HPP
6 #define BOOST_HANA_TEST_AUTO_REVERSE_HPP
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/equal.hpp>
10 #include <boost/hana/reverse.hpp>
12 #include "test_case.hpp"
13 #include <laws/base.hpp>
16 TestCase test_reverse{[]{
17 namespace hana = boost::hana;
18 using hana::test::ct_eq;
19 using hana::test::cx_eq;
21 BOOST_HANA_CONSTANT_CHECK(hana::equal(
22 hana::reverse(MAKE_TUPLE()),
25 BOOST_HANA_CONSTANT_CHECK(hana::equal(
26 hana::reverse(MAKE_TUPLE(ct_eq<0>{})),
27 MAKE_TUPLE(ct_eq<0>{})
29 BOOST_HANA_CONSTANT_CHECK(hana::equal(
30 hana::reverse(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{})),
31 MAKE_TUPLE(ct_eq<1>{}, ct_eq<0>{})
33 BOOST_HANA_CONSTANT_CHECK(hana::equal(
34 hana::reverse(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})),
35 MAKE_TUPLE(ct_eq<2>{}, ct_eq<1>{}, ct_eq<0>{})
39 #ifndef MAKE_TUPLE_NO_CONSTEXPR
40 static_assert(hana::equal(
41 hana::reverse(MAKE_TUPLE(cx_eq<1>{})),
42 MAKE_TUPLE(cx_eq<1>{})
44 static_assert(hana::equal(
45 hana::reverse(MAKE_TUPLE(cx_eq<1>{}, cx_eq<2>{})),
46 MAKE_TUPLE(cx_eq<2>{}, cx_eq<1>{})
48 static_assert(hana::equal(
49 hana::reverse(MAKE_TUPLE(cx_eq<1>{}, cx_eq<2>{}, cx_eq<3>{})),
50 MAKE_TUPLE(cx_eq<3>{}, cx_eq<2>{}, cx_eq<1>{})
55 #endif // !BOOST_HANA_TEST_AUTO_REVERSE_HPP