• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <boost/hana/assert.hpp>
6 #include <boost/hana/core/make.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/find.hpp>
9 #include <boost/hana/integral_constant.hpp>
10 #include <boost/hana/optional.hpp>
11 #include <boost/hana/range.hpp>
12 
13 #include <support/cnumeric.hpp>
14 namespace hana = boost::hana;
15 
16 
main()17 int main() {
18     BOOST_HANA_CONSTANT_CHECK(hana::equal(
19         hana::find(hana::make_range(hana::int_c<0>, hana::int_c<0>), cnumeric<int, 0>),
20         hana::nothing
21     ));
22 
23     BOOST_HANA_CONSTANT_CHECK(hana::equal(
24         hana::find(hana::make_range(hana::int_c<0>, hana::int_c<1>), cnumeric<int, 0>),
25         hana::just(hana::int_c<0>)
26     ));
27 
28     BOOST_HANA_CONSTANT_CHECK(hana::equal(
29         hana::find(hana::make_range(hana::int_c<0>, hana::int_c<10>), cnumeric<int, 3>),
30         hana::just(hana::int_c<3>)
31     ));
32 
33     BOOST_HANA_CONSTANT_CHECK(hana::equal(
34         hana::find(hana::make_range(hana::int_c<0>, hana::int_c<10>), cnumeric<int, 9>),
35         hana::just(hana::int_c<9>)
36     ));
37 
38     BOOST_HANA_CONSTANT_CHECK(hana::equal(
39         hana::find(hana::make_range(hana::int_c<-10>, hana::int_c<10>), cnumeric<int, -10>),
40         hana::just(hana::int_c<-10>)
41     ));
42 
43     BOOST_HANA_CONSTANT_CHECK(hana::equal(
44         hana::find(hana::make_range(hana::int_c<-10>, hana::int_c<10>), cnumeric<int, -5>),
45         hana::just(hana::int_c<-5>)
46     ));
47 
48     BOOST_HANA_CONSTANT_CHECK(hana::equal(
49         hana::find(hana::make_range(hana::int_c<-10>, hana::int_c<0>), cnumeric<int, 3>),
50         hana::nothing
51     ));
52 
53     BOOST_HANA_CONSTANT_CHECK(hana::equal(
54         hana::find(hana::make_range(hana::int_c<0>, hana::int_c<10>), cnumeric<int, 15>),
55         hana::nothing
56     ));
57 }
58