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