diff options
Diffstat (limited to 'src/boost/libs/hana/test/_include/auto/length.hpp')
-rw-r--r-- | src/boost/libs/hana/test/_include/auto/length.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/_include/auto/length.hpp b/src/boost/libs/hana/test/_include/auto/length.hpp new file mode 100644 index 000000000..25f75dc4d --- /dev/null +++ b/src/boost/libs/hana/test/_include/auto/length.hpp @@ -0,0 +1,48 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_HANA_TEST_AUTO_LENGTH_HPP +#define BOOST_HANA_TEST_AUTO_LENGTH_HPP + +#include <boost/hana/assert.hpp> +#include <boost/hana/equal.hpp> +#include <boost/hana/integral_constant.hpp> +#include <boost/hana/length.hpp> + +#include "test_case.hpp" + + +namespace _test_length_detail { template <int> struct undefined { }; } + +TestCase test_length{[]{ + namespace hana = boost::hana; + using _test_length_detail::undefined; + + BOOST_HANA_CONSTANT_CHECK(hana::equal( + hana::length(MAKE_TUPLE()), + hana::size_c<0> + )); + + BOOST_HANA_CONSTANT_CHECK(hana::equal( + hana::length(MAKE_TUPLE(undefined<1>{})), + hana::size_c<1> + )); + + BOOST_HANA_CONSTANT_CHECK(hana::equal( + hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{})), + hana::size_c<2> + )); + + BOOST_HANA_CONSTANT_CHECK(hana::equal( + hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{}, undefined<3>{})), + hana::size_c<3> + )); + + BOOST_HANA_CONSTANT_CHECK(hana::equal( + hana::length(MAKE_TUPLE(undefined<1>{}, undefined<2>{}, undefined<3>{}, undefined<4>{}, undefined<5>{}, undefined<6>{})), + hana::size_c<6> + )); +}}; + +#endif // !BOOST_HANA_TEST_AUTO_LENGTH_HPP |