Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / _include / auto / drop_while.hpp
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_DROP_WHILE_HPP
6 #define BOOST_HANA_TEST_AUTO_DROP_WHILE_HPP
7
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>
14
15 #include <laws/base.hpp>
16 #include "test_case.hpp"
17
18
19 TestCase test_drop_while{[]{
20     namespace hana = boost::hana;
21     using hana::test::ct_eq;
22
23     BOOST_HANA_CONSTANT_CHECK(hana::equal(
24         hana::drop_while(MAKE_TUPLE(), hana::id),
25         MAKE_TUPLE()
26     ));
27
28     BOOST_HANA_CONSTANT_CHECK(hana::equal(
29         hana::drop_while(MAKE_TUPLE(hana::true_c), hana::id),
30         MAKE_TUPLE()
31     ));
32     BOOST_HANA_CONSTANT_CHECK(hana::equal(
33         hana::drop_while(MAKE_TUPLE(hana::false_c), hana::id),
34         MAKE_TUPLE(hana::false_c)
35     ));
36
37     BOOST_HANA_CONSTANT_CHECK(hana::equal(
38         hana::drop_while(MAKE_TUPLE(hana::true_c, hana::true_c), hana::id),
39         MAKE_TUPLE()
40     ));
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)
44     ));
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)
48     ));
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)
52     ));
53
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>{})),
56         MAKE_TUPLE()
57     ));
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>{})
61     ));
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>{})
65     ));
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>{})
69     ));
70 }};
71
72 #endif // !BOOST_HANA_TEST_AUTO_DROP_WHILE_HPP