]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // Copyright Louis Dionne 2013-2017 |
7c673cae FG |
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/ext/std/integral_constant.hpp> | |
6 | ||
7 | #include <boost/hana/assert.hpp> | |
8 | #include <boost/hana/equal.hpp> | |
9 | #include <boost/hana/eval_if.hpp> | |
10 | #include <boost/hana/functional/always.hpp> | |
11 | #include <boost/hana/integral_constant.hpp> | |
12 | #include <boost/hana/not.hpp> | |
13 | #include <boost/hana/tuple.hpp> | |
14 | ||
15 | #include <laws/base.hpp> | |
16 | #include <laws/logical.hpp> | |
17 | ||
18 | #include <type_traits> | |
19 | namespace hana = boost::hana; | |
20 | ||
21 | ||
22 | int main() { | |
23 | // eval_if | |
24 | { | |
25 | auto t = hana::test::ct_eq<3>{}; | |
26 | auto e = hana::test::ct_eq<4>{}; | |
27 | ||
28 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
29 | hana::eval_if(std::true_type{}, hana::always(t), hana::always(e)), | |
30 | t | |
31 | )); | |
32 | ||
33 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
34 | hana::eval_if(std::false_type{}, hana::always(t), hana::always(e)), | |
35 | e | |
36 | )); | |
37 | } | |
38 | ||
39 | // not_ | |
40 | { | |
41 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
42 | hana::not_(std::true_type{}), | |
43 | std::false_type{} | |
44 | )); | |
45 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
46 | hana::not_(std::false_type{}), | |
47 | std::true_type{} | |
48 | )); | |
49 | } | |
50 | ||
51 | auto ints = hana::make_tuple( | |
52 | std::integral_constant<int, -2>{}, | |
53 | std::integral_constant<int, 0>{}, | |
54 | std::integral_constant<int, 1>{}, | |
55 | std::integral_constant<int, 3>{} | |
56 | ); | |
57 | ||
58 | auto bools = hana::make_tuple(std::true_type{}, std::false_type{}); | |
59 | ||
60 | // laws | |
61 | hana::test::TestLogical<hana::ext::std::integral_constant_tag<int>>{ints}; | |
62 | hana::test::TestLogical<hana::ext::std::integral_constant_tag<bool>>{bools}; | |
63 | } |