forked from boostorg/mp11
Add test/mp_map_find_3
This commit is contained in:
@@ -187,6 +187,7 @@ run mp_similar.cpp ;
|
||||
# map
|
||||
run mp_map_find.cpp ;
|
||||
run mp_map_find_2.cpp ;
|
||||
run mp_map_find_3.cpp ;
|
||||
run mp_map_contains.cpp ;
|
||||
run mp_map_insert.cpp ;
|
||||
run mp_map_replace.cpp ;
|
||||
|
@@ -11,23 +11,23 @@
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <tuple>
|
||||
|
||||
struct Foo {};
|
||||
struct Bar {};
|
||||
struct X {};
|
||||
struct Y {};
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mp11::mp_map_find;
|
||||
|
||||
using L1 = std::tuple<std::tuple<int, int>, std::tuple<long, long>, std::tuple<bool, Foo>, std::tuple<Foo, bool>>;
|
||||
using L1 = std::tuple<std::tuple<int, int>, std::tuple<long, long>, std::tuple<bool, X>, std::tuple<X, bool>>;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, int>, std::tuple<int, int> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, bool>, std::tuple<bool, Foo> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, Foo>, std::tuple<Foo, bool> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, bool>, std::tuple<bool, X> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, X>, std::tuple<X, bool> );
|
||||
|
||||
using L2 = std::tuple<std::tuple<Foo, Bar>, std::tuple<Bar, Foo>>;
|
||||
using L2 = std::tuple<std::tuple<X, Y>, std::tuple<Y, X>>;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, Foo>, std::tuple<Foo, Bar> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, Bar>, std::tuple<Bar, Foo> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, X>, std::tuple<X, Y> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, Y>, std::tuple<Y, X> );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
34
test/mp_map_find_3.cpp
Normal file
34
test/mp_map_find_3.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
// Copyright 2016, 2020 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
|
||||
|
||||
// Same as mp_map_find_2.cpp, but with includes reversed
|
||||
|
||||
#include <tuple>
|
||||
#include <boost/mp11/map.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
|
||||
struct X {};
|
||||
struct Y {};
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mp11::mp_map_find;
|
||||
|
||||
using L1 = std::tuple<std::tuple<int, int>, std::tuple<long, long>, std::tuple<bool, X>, std::tuple<X, bool>>;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, int>, std::tuple<int, int> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, bool>, std::tuple<bool, X> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L1, X>, std::tuple<X, bool> );
|
||||
|
||||
using L2 = std::tuple<std::tuple<X, Y>, std::tuple<Y, X>>;
|
||||
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, X>, std::tuple<X, Y> );
|
||||
BOOST_TEST_TRAIT_SAME( mp_map_find<L2, Y>, std::tuple<Y, X> );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user