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)
5 #ifndef BOOST_HANA_TEST_AUTO_DROP_WHILE_HPP
6 #define BOOST_HANA_TEST_AUTO_DROP_WHILE_HPP
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/bool.hpp>
10 #include <boost/hana/drop_while.hpp>
11 #include <boost/hana/equal.hpp>
12 #include <boost/hana/functional/id.hpp>
13 #include <boost/hana/not_equal.hpp>
15 #include <laws/base.hpp>
16 #include "test_case.hpp"
19 TestCase test_drop_while{[]{
20 namespace hana = boost::hana;
21 using hana::test::ct_eq;
23 BOOST_HANA_CONSTANT_CHECK(hana::equal(
24 hana::drop_while(MAKE_TUPLE(), hana::id),
28 BOOST_HANA_CONSTANT_CHECK(hana::equal(
29 hana::drop_while(MAKE_TUPLE(hana::true_c), hana::id),
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::drop_while(MAKE_TUPLE(hana::false_c), hana::id),
34 MAKE_TUPLE(hana::false_c)
37 BOOST_HANA_CONSTANT_CHECK(hana::equal(
38 hana::drop_while(MAKE_TUPLE(hana::true_c, hana::true_c), hana::id),
41 BOOST_HANA_CONSTANT_CHECK(hana::equal(
42 hana::drop_while(MAKE_TUPLE(hana::true_c, hana::false_c), hana::id),
43 MAKE_TUPLE(hana::false_c)
45 BOOST_HANA_CONSTANT_CHECK(hana::equal(
46 hana::drop_while(MAKE_TUPLE(hana::false_c, hana::true_c), hana::id),
47 MAKE_TUPLE(hana::false_c, hana::true_c)
49 BOOST_HANA_CONSTANT_CHECK(hana::equal(
50 hana::drop_while(MAKE_TUPLE(hana::false_c, hana::false_c), hana::id),
51 MAKE_TUPLE(hana::false_c, hana::false_c)
54 BOOST_HANA_CONSTANT_CHECK(hana::equal(
55 hana::drop_while(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}), hana::not_equal.to(ct_eq<99>{})),
58 BOOST_HANA_CONSTANT_CHECK(hana::equal(
59 hana::drop_while(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}), hana::not_equal.to(ct_eq<1>{})),
60 MAKE_TUPLE(ct_eq<1>{}, ct_eq<2>{})
62 BOOST_HANA_CONSTANT_CHECK(hana::equal(
63 hana::drop_while(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::not_equal.to(ct_eq<3>{})),
64 MAKE_TUPLE(ct_eq<3>{})
66 BOOST_HANA_CONSTANT_CHECK(hana::equal(
67 hana::drop_while(MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}), hana::not_equal.to(ct_eq<0>{})),
68 MAKE_TUPLE(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
72 #endif // !BOOST_HANA_TEST_AUTO_DROP_WHILE_HPP