• 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 #ifndef BOOST_HANA_TEST_AUTO_REVERSE_HPP
6 #define BOOST_HANA_TEST_AUTO_REVERSE_HPP
7 
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/equal.hpp>
10 #include <boost/hana/reverse.hpp>
11 
12 #include "test_case.hpp"
13 #include <laws/base.hpp>
14 
15 
__anondae014b80102null16 TestCase test_reverse{[]{
17     namespace hana = boost::hana;
18     using hana::test::ct_eq;
19     using hana::test::cx_eq;
20 
21     BOOST_HANA_CONSTANT_CHECK(hana::equal(
22         hana::reverse(MAKE_TUPLE()),
23         MAKE_TUPLE()
24     ));
25     BOOST_HANA_CONSTANT_CHECK(hana::equal(
26         hana::reverse(MAKE_TUPLE(ct_eq<0>{})),
27         MAKE_TUPLE(ct_eq<0>{})
28     ));
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>{})
32     ));
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>{})
36     ));
37 
38 
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>{})
43     ), "");
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>{})
47     ), "");
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>{})
51     ), "");
52 #endif
53 }};
54 
55 #endif // !BOOST_HANA_TEST_AUTO_REVERSE_HPP
56