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/integral_constant.hpp>
9 #include <boost/hana/product.hpp>
10 #include <boost/hana/range.hpp>
11 namespace hana = boost::hana;
12
13
main()14 int main() {
15 BOOST_HANA_CONSTANT_CHECK(hana::equal(
16 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<-3>)),
17 hana::int_c<1>
18 ));
19 BOOST_HANA_CONSTANT_CHECK(hana::equal(
20 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<-2>)),
21 hana::int_c<-3>
22 ));
23 BOOST_HANA_CONSTANT_CHECK(hana::equal(
24 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<-1>)),
25 hana::int_c<-3 * -2>
26 ));
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<0>)),
29 hana::int_c<-3 * -2 * -1>
30 ));
31 BOOST_HANA_CONSTANT_CHECK(hana::equal(
32 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<1>)),
33 hana::int_c<-3 * -2 * -1 * 0>
34 ));
35 BOOST_HANA_CONSTANT_CHECK(hana::equal(
36 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<2>)),
37 hana::int_c<-3 * -2 * -1 * 0 * 1>
38 ));
39 BOOST_HANA_CONSTANT_CHECK(hana::equal(
40 hana::product<>(hana::make_range(hana::int_c<-3>, hana::int_c<3>)),
41 hana::int_c<-3 * -2 * -1 * 0 * 1 * 2>
42 ));
43
44 BOOST_HANA_CONSTANT_CHECK(hana::equal(
45 hana::product<>(hana::make_range(hana::int_c<1>, hana::int_c<1>)),
46 hana::int_c<1>
47 ));
48 BOOST_HANA_CONSTANT_CHECK(hana::equal(
49 hana::product<>(hana::make_range(hana::int_c<1>, hana::int_c<2>)),
50 hana::int_c<1>
51 ));
52 BOOST_HANA_CONSTANT_CHECK(hana::equal(
53 hana::product<>(hana::make_range(hana::int_c<1>, hana::int_c<3>)),
54 hana::int_c<1 * 2>
55 ));
56 BOOST_HANA_CONSTANT_CHECK(hana::equal(
57 hana::product<>(hana::make_range(hana::int_c<1>, hana::int_c<4>)),
58 hana::int_c<1 * 2 * 3>
59 ));
60 BOOST_HANA_CONSTANT_CHECK(hana::equal(
61 hana::product<>(hana::make_range(hana::int_c<1>, hana::int_c<5>)),
62 hana::int_c<1 * 2 * 3 * 4>
63 ));
64
65 BOOST_HANA_CONSTANT_CHECK(hana::equal(
66 hana::product<>(hana::make_range(hana::int_c<3>, hana::int_c<3>)),
67 hana::int_c<1>
68 ));
69 BOOST_HANA_CONSTANT_CHECK(hana::equal(
70 hana::product<>(hana::make_range(hana::int_c<3>, hana::int_c<4>)),
71 hana::int_c<3>
72 ));
73 BOOST_HANA_CONSTANT_CHECK(hana::equal(
74 hana::product<>(hana::make_range(hana::int_c<3>, hana::int_c<5>)),
75 hana::int_c<3 * 4>
76 ));
77 BOOST_HANA_CONSTANT_CHECK(hana::equal(
78 hana::product<>(hana::make_range(hana::int_c<3>, hana::int_c<6>)),
79 hana::int_c<3 * 4 * 5>
80 ));
81 BOOST_HANA_CONSTANT_CHECK(hana::equal(
82 hana::product<>(hana::make_range(hana::int_c<3>, hana::int_c<7>)),
83 hana::int_c<3 * 4 * 5 * 6>
84 ));
85 }
86