forked from boostorg/range
type_erased test separated the template parameter conversion test.
This commit is contained in:
@ -53,6 +53,7 @@ test-suite range :
|
||||
[ range-test adaptor_test/type_erased_abstract ]
|
||||
[ range-test adaptor_test/type_erased_brackets ]
|
||||
[ range-test adaptor_test/type_erased_mix_values ]
|
||||
[ range-test adaptor_test/type_erased_tparam_conv ]
|
||||
[ range-test adaptor_test/uniqued ]
|
||||
[ range-test adaptor_test/adjacent_filtered_example ]
|
||||
[ range-test adaptor_test/copied_example ]
|
||||
|
@ -77,45 +77,6 @@ void test_type_erased_random_access()
|
||||
test_type_erased_exercise_buffer_types< std::vector<MockType>, boost::random_access_traversal_tag >();
|
||||
}
|
||||
|
||||
void test_type_erased_multiple_different_template_parameter_conversion()
|
||||
{
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::random_access_traversal_tag
|
||||
, int&
|
||||
, std::ptrdiff_t
|
||||
> source_range_type;
|
||||
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::single_pass_traversal_tag
|
||||
, const int&
|
||||
, std::ptrdiff_t
|
||||
> target_range_type;
|
||||
|
||||
source_range_type source;
|
||||
|
||||
// Converting via construction
|
||||
target_range_type t1(source);
|
||||
|
||||
// Converting via assignment
|
||||
target_range_type t2;
|
||||
t2 = source;
|
||||
|
||||
// Converting via construction to a type with a reference type
|
||||
// that is a value
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::single_pass_traversal_tag
|
||||
, int
|
||||
, std::ptrdiff_t
|
||||
> target_range2_type;
|
||||
|
||||
target_range2_type t3(source);
|
||||
target_range2_type t4;
|
||||
t4 = source;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_adaptor_type_erased_test
|
||||
|
||||
@ -130,7 +91,6 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_forward ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_bidirectional ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_random_access ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_multiple_different_template_parameter_conversion ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
78
test/adaptor_test/type_erased_tparam_conv.cpp
Normal file
78
test/adaptor_test/type_erased_tparam_conv.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is subject to 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/range/adaptor/type_erased.hpp>
|
||||
#include "type_erased_test.hpp"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_adaptor_type_erased_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void template_parameter_conversion()
|
||||
{
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::random_access_traversal_tag
|
||||
, int&
|
||||
, std::ptrdiff_t
|
||||
> source_range_type;
|
||||
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::single_pass_traversal_tag
|
||||
, const int&
|
||||
, std::ptrdiff_t
|
||||
> target_range_type;
|
||||
|
||||
source_range_type source;
|
||||
|
||||
// Converting via construction
|
||||
target_range_type t1(source);
|
||||
|
||||
// Converting via assignment
|
||||
target_range_type t2;
|
||||
t2 = source;
|
||||
|
||||
// Converting via construction to a type with a reference type
|
||||
// that is a value
|
||||
typedef boost::any_range<
|
||||
int
|
||||
, boost::single_pass_traversal_tag
|
||||
, int
|
||||
, std::ptrdiff_t
|
||||
> target_range2_type;
|
||||
|
||||
target_range2_type t3(source);
|
||||
target_range2_type t4;
|
||||
t4 = source;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_adaptor_type_erased_test
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("RangeTestSuite.adaptor.type_erased_tparam_conv");
|
||||
|
||||
test->add(BOOST_TEST_CASE(
|
||||
&boost_range_adaptor_type_erased_test::template_parameter_conversion));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
Reference in New Issue
Block a user