From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/mp11/test/mpl.cpp | 108 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/boost/libs/mp11/test/mpl.cpp (limited to 'src/boost/libs/mp11/test/mpl.cpp') diff --git a/src/boost/libs/mp11/test/mpl.cpp b/src/boost/libs/mp11/test/mpl.cpp new file mode 100644 index 00000000..5e9551ec --- /dev/null +++ b/src/boost/libs/mp11/test/mpl.cpp @@ -0,0 +1,108 @@ + +// Copyright 2017 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +template using add_pointer_t = typename std::add_pointer::type; + +template void test() +{ + namespace mpl = boost::mpl; + using namespace boost::mp11; + + // intrinsics + + BOOST_TEST_TRAIT_TRUE((std::is_same>::type, mp_at_c>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>::type, mp_at_c>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>::type, mp_at_c>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_at_c>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_at_c>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_at_c>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, float>)); + + BOOST_TEST_EQ((mpl::distance::type, typename mpl::end::type>::type::value), mp_size::value); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_clear>)); + + BOOST_TEST_TRAIT_FALSE((typename mpl::empty::type)); + BOOST_TEST_TRAIT_TRUE((typename mpl::empty>::type)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type>::type, mp_pop_front>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_front>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, void>::type, mp_push_front>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::type, void>::type, mp_push_back>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, L1>::type, mp_append>)); + + BOOST_TEST_TRAIT_TRUE((typename mpl::is_sequence::type)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_pop_front>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_push_back>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_push_front>)); + + BOOST_TEST_EQ((mpl::size::type::value), mp_size::value); + + // algorithms + + BOOST_TEST_TRAIT_TRUE((std::is_same>::type, mp_transform>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_reverse>)); + + BOOST_TEST_TRAIT_TRUE((std::is_same::type, mp_remove>)); + + using L2 = typename mpl::copy>>::type; + using L3 = typename mpl::copy>>::type; + + BOOST_TEST_TRAIT_TRUE((std::is_same)); +} + +int main() +{ + using boost::mp11::mp_list; + + test>(); + test>(); // MPL instantiates the tuple, so no 'void' + + return boost::report_errors(); +} -- cgit v1.2.3