]>
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/boost/mpl/integral_c.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/not.hpp> | |
12 | #include <boost/hana/tuple.hpp> | |
13 | ||
14 | #include <laws/base.hpp> | |
15 | #include <laws/logical.hpp> | |
16 | ||
17 | #include <boost/mpl/bool.hpp> | |
18 | #include <boost/mpl/int.hpp> | |
19 | #include <boost/mpl/integral_c.hpp> | |
20 | namespace hana = boost::hana; | |
21 | namespace mpl = boost::mpl; | |
22 | ||
23 | ||
24 | int main() { | |
25 | // eval_if | |
26 | { | |
27 | auto t = hana::test::ct_eq<3>{}; | |
28 | auto e = hana::test::ct_eq<4>{}; | |
29 | ||
30 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
31 | hana::eval_if(mpl::true_{}, hana::always(t), hana::always(e)), | |
32 | t | |
33 | )); | |
34 | ||
35 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
36 | hana::eval_if(mpl::false_{}, hana::always(t), hana::always(e)), | |
37 | e | |
38 | )); | |
39 | } | |
40 | ||
41 | // not_ | |
42 | { | |
43 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
44 | hana::not_(mpl::true_{}), | |
45 | mpl::false_{} | |
46 | )); | |
47 | BOOST_HANA_CONSTANT_CHECK(hana::equal( | |
48 | hana::not_(mpl::false_{}), | |
49 | mpl::true_{} | |
50 | )); | |
51 | } | |
52 | ||
53 | // laws | |
54 | hana::test::TestLogical<hana::ext::boost::mpl::integral_c_tag<int>>{ | |
55 | hana::make_tuple( | |
56 | mpl::int_<-2>{}, mpl::integral_c<int, 0>{}, mpl::integral_c<int, 3>{} | |
57 | ) | |
58 | }; | |
59 | ||
60 | hana::test::TestLogical<hana::ext::boost::mpl::integral_c_tag<bool>>{ | |
61 | hana::make_tuple( | |
62 | mpl::true_{}, mpl::false_{}, | |
63 | mpl::integral_c<bool, true>{}, mpl::integral_c<bool, false>{} | |
64 | ) | |
65 | }; | |
66 | } |