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 #ifndef BOOST_HANA_TEST_AUTO_LENGTH_HPP
6 #define BOOST_HANA_TEST_AUTO_LENGTH_HPP
7
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/equal.hpp>
10 #include <boost/hana/integral_constant.hpp>
11 #include <boost/hana/length.hpp>
12
13 #include "test_case.hpp"
14
15
16 namespace _test_length_detail { template <int> struct undefined { }; }
17
__anon2b0380990102null18 TestCase test_length{[]{
19 namespace hana = boost::hana;
20 using _test_length_detail::undefined;
21
22 BOOST_HANA_CONSTANT_CHECK(hana::equal(
23 hana::length(MAKE_TUPLE()),
24 hana::size_c<0>
25 ));
26
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::length(MAKE_TUPLE(undefined<1>{})),
29 hana::size_c<1>
30 ));
31
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{})),
34 hana::size_c<2>
35 ));
36
37 BOOST_HANA_CONSTANT_CHECK(hana::equal(
38 hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{}, undefined<3>{})),
39 hana::size_c<3>
40 ));
41
42 BOOST_HANA_CONSTANT_CHECK(hana::equal(
43 hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{}, undefined<3>{}, undefined<4>{}, undefined<5>{}, undefined<6>{})),
44 hana::size_c<6>
45 ));
46 }};
47
48 #endif // !BOOST_HANA_TEST_AUTO_LENGTH_HPP
49