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