1
0
forked from boostorg/mp11

Add test/mpl_tuple.cpp

This commit is contained in:
Peter Dimov
2019-08-23 20:51:13 +03:00
parent 85a2099874
commit 0ca69d98c9
2 changed files with 37 additions and 0 deletions

View File

@ -192,6 +192,7 @@ run mp_bind_back.cpp ;
# mpl
run mpl.cpp : ;
run mpl_list.cpp : ;
run mpl_tuple.cpp : ;
# version
run version.cpp ;

36
test/mpl_tuple.cpp Normal file
View File

@ -0,0 +1,36 @@
// Copyright 2017, 2019 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 <boost/mp11/mpl_tuple.hpp>
#include <tuple>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
#include <boost/core/lightweight_test_trait.hpp>
int main()
{
namespace mpl = boost::mpl;
using namespace boost::mp11;
using L1 = std::tuple<char, int, float>;
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<0>>::type, mp_at_c<L1, 0>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<1>>::type, mp_at_c<L1, 1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at<L1, mpl::int_<2>>::type, mp_at_c<L1, 2>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 0>::type, mp_at_c<L1, 0>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 1>::type, mp_at_c<L1, 1>>));
BOOST_TEST_TRAIT_TRUE((std::is_same<typename mpl::at_c<L1, 2>::type, mp_at_c<L1, 2>>));
BOOST_TEST_EQ((mpl::size<L1>::type::value), mp_size<L1>::value);
return boost::report_errors();
}