mirror of
https://github.com/boostorg/range.git
synced 2025-07-15 21:52:17 +02:00
[boost][range] - Improved the tests by implementing outside of the boost namespace to better simulate real world usage.
[SVN r67602]
This commit is contained in:
@ -22,32 +22,30 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_find
|
||||
{
|
||||
class find_test_policy
|
||||
{
|
||||
public:
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::find(cont, 3);
|
||||
iter_t result2 = boost::find(boost::make_iterator_range(cont), 3);
|
||||
BOOST_CHECK( result == result2 );
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find<return_type>(cont, 3);
|
||||
result_t result2 = boost::find<return_type>(boost::make_iterator_range(cont), 3);
|
||||
BOOST_CHECK( result == result2 );
|
||||
@ -56,7 +54,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find(cont.begin(), cont.end(), 3);
|
||||
@ -68,9 +66,9 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t mcont;
|
||||
Container& cont = mcont;
|
||||
@ -102,7 +100,6 @@ namespace boost
|
||||
BOOST_CHECK( it == it2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -110,7 +107,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_find ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find::test_find ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_find_end
|
||||
{
|
||||
template<class Container2>
|
||||
class find_end_test_policy
|
||||
@ -38,10 +36,10 @@ namespace boost
|
||||
container2_t cont() { return m_cont; }
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::find_end(cont, m_cont);
|
||||
BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), m_cont) );
|
||||
BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) );
|
||||
@ -49,14 +47,14 @@ namespace boost
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find_end<return_type>(cont, policy.cont());
|
||||
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont), policy.cont()) );
|
||||
BOOST_CHECK( result == boost::find_end<return_type>(cont, boost::make_iterator_range(policy.cont())) );
|
||||
@ -67,7 +65,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find_end(cont.begin(), cont.end(),
|
||||
@ -92,10 +90,10 @@ namespace boost
|
||||
BinaryPredicate& pred() { return m_pred; }
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t it = boost::find_end(cont, m_cont, m_pred);
|
||||
BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), m_cont, m_pred) );
|
||||
BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(m_cont), m_pred) );
|
||||
@ -103,14 +101,14 @@ namespace boost
|
||||
return it;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find_end<return_type>(cont, policy.cont(), policy.pred());
|
||||
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont), policy.cont(), policy.pred()) );
|
||||
BOOST_CHECK( result == boost::find_end<return_type>(cont, boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||
@ -121,7 +119,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find_end(cont.begin(), cont.end(),
|
||||
@ -137,7 +135,7 @@ namespace boost
|
||||
template<class Container1, class Container2>
|
||||
void run_tests(Container1& cont1, Container2& cont2)
|
||||
{
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
test_driver(cont1, find_end_test_policy<Container2>(cont2));
|
||||
test_driver(cont1, find_end_pred_test_policy<Container2, std::less<int> >(cont2));
|
||||
test_driver(cont2, find_end_pred_test_policy<Container2, std::greater<int> >(cont2));
|
||||
@ -148,8 +146,8 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container1>::type container1_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container2>::type container2_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container1>::type container1_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container2>::type container2_t;
|
||||
|
||||
container1_t mcont1;
|
||||
Container1& cont1 = mcont1;
|
||||
@ -189,7 +187,6 @@ namespace boost
|
||||
test_find_end_impl< std::list<int>, std::vector<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -197,7 +194,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_end" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_find_end ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_end::test_find_end ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_find_first_of
|
||||
{
|
||||
template<class Container2>
|
||||
class find_first_of_test_policy
|
||||
@ -38,10 +36,10 @@ namespace boost
|
||||
container2_t& cont() { return m_cont; }
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::find_first_of(cont, m_cont);
|
||||
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont) );
|
||||
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) );
|
||||
@ -49,14 +47,14 @@ namespace boost
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find_first_of<return_type>(cont, policy.cont());
|
||||
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), policy.cont()) );
|
||||
BOOST_CHECK( result == boost::find_first_of<return_type>(cont, boost::make_iterator_range(policy.cont())) );
|
||||
@ -66,7 +64,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find_first_of(cont.begin(), cont.end(),
|
||||
@ -91,10 +89,10 @@ namespace boost
|
||||
BinaryPredicate& pred() { return m_pred; }
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::find_first_of(cont, m_cont, m_pred);
|
||||
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont, m_pred) );
|
||||
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) );
|
||||
@ -102,14 +100,14 @@ namespace boost
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find_first_of<return_type>(cont, policy.cont(), policy.pred());
|
||||
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), policy.cont(), policy.pred()) );
|
||||
BOOST_CHECK( result == boost::find_first_of<return_type>(cont, boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||
@ -119,7 +117,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find_first_of(cont.begin(), cont.end(),
|
||||
@ -135,7 +133,7 @@ namespace boost
|
||||
template<class Container1, class Container2>
|
||||
void run_tests(Container1& cont1, Container2& cont2)
|
||||
{
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
test_driver(cont1, find_first_of_test_policy<Container2>(cont2));
|
||||
test_driver(cont1, find_first_of_pred_test_policy<Container2, std::less<int> >(cont2));
|
||||
test_driver(cont2, find_first_of_pred_test_policy<Container2, std::greater<int> >(cont2));
|
||||
@ -146,8 +144,8 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container1>::type container1_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container2>::type container2_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container1>::type container1_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container2>::type container2_t;
|
||||
|
||||
container1_t mcont1;
|
||||
Container1& cont1 = mcont1;
|
||||
@ -187,7 +185,6 @@ namespace boost
|
||||
test_find_first_of_impl< std::list<int>, std::vector<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -195,7 +192,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_first_of" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_find_first_of ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_first_of::test_find_first_of ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -23,9 +23,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_find_if
|
||||
{
|
||||
template<class UnaryPredicate>
|
||||
class find_if_test_policy
|
||||
@ -35,23 +33,23 @@ namespace boost
|
||||
: m_pred(pred) {}
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::find_if(cont, m_pred);
|
||||
BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(find_if_test_policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::find_if<return_type>(cont, policy.pred());
|
||||
BOOST_CHECK( result == boost::find_if<return_type>(boost::make_iterator_range(cont), policy.pred()) );
|
||||
return result;
|
||||
@ -59,7 +57,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::find_if(cont.begin(), cont.end(), m_pred);
|
||||
@ -84,9 +82,9 @@ namespace boost
|
||||
using namespace boost::assign;
|
||||
using namespace boost::range_test_function;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t mcont;
|
||||
Container& cont = mcont;
|
||||
@ -115,7 +113,6 @@ namespace boost
|
||||
test_find_if_container< const std::deque<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -123,7 +120,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_if" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_find_if ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_if::test_find_if ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -22,31 +22,29 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_lower_bound
|
||||
{
|
||||
class lower_bound_policy
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::lower_bound(cont, 5);
|
||||
BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::lower_bound<return_type>(cont, 5);
|
||||
BOOST_CHECK( result == boost::lower_bound<return_type>(boost::make_iterator_range(cont), 5) );
|
||||
return result;
|
||||
@ -54,7 +52,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::lower_bound(cont.begin(), cont.end(), 5);
|
||||
@ -65,24 +63,24 @@ namespace boost
|
||||
struct lower_bound_pred_policy
|
||||
{
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::lower_bound(cont, 5, m_pred);
|
||||
BOOST_CHECK( result == boost::lower_bound(
|
||||
boost::make_iterator_range(cont), 5, m_pred) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::lower_bound<return_type>(cont, 5, policy.pred());
|
||||
BOOST_CHECK( result == boost::lower_bound<return_type>(
|
||||
boost::make_iterator_range(cont), 5, policy.pred()) );
|
||||
@ -91,7 +89,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::lower_bound(
|
||||
@ -111,10 +109,10 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t mcont;
|
||||
Container& cont = mcont;
|
||||
@ -170,8 +168,6 @@ namespace boost
|
||||
test_lower_bound_impl< const std::deque<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -179,7 +175,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.lower_bound" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_lower_bound ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_lower_bound::test_lower_bound ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -22,32 +22,30 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_max_element
|
||||
{
|
||||
class max_element_test_policy
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::max_element(cont);
|
||||
BOOST_CHECK( result == boost::max_element(
|
||||
boost::make_iterator_range(cont)) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value return_type>
|
||||
template<boost::range_return_value return_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::max_element<return_type>(cont);
|
||||
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||
boost::make_iterator_range(cont)) );
|
||||
@ -56,7 +54,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::max_element(cont.begin(), cont.end());
|
||||
@ -68,10 +66,10 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::max_element(cont, Pred());
|
||||
BOOST_CHECK( result == boost::max_element(
|
||||
boost::make_iterator_range(cont), Pred()) );
|
||||
@ -80,14 +78,14 @@ namespace boost
|
||||
|
||||
Pred pred() const { return Pred(); }
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::max_element<return_type>(cont, policy.pred());
|
||||
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||
boost::make_iterator_range(cont), policy.pred()) );
|
||||
@ -96,7 +94,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::max_element(cont.begin(), cont.end(), Pred());
|
||||
@ -109,9 +107,9 @@ namespace boost
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t cont;
|
||||
|
||||
@ -151,7 +149,6 @@ namespace boost
|
||||
test_max_element_impl< std::list<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -159,7 +156,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.max_element" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_max_element ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_max_element::test_max_element ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -22,31 +22,29 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_min_element
|
||||
{
|
||||
class min_element_test_policy
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::min_element(cont);
|
||||
BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::min_element<return_type>(cont);
|
||||
BOOST_CHECK( result == boost::min_element<return_type>(boost::make_iterator_range(cont)) );
|
||||
return result;
|
||||
@ -54,7 +52,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::min_element(cont.begin(), cont.end());
|
||||
@ -66,10 +64,10 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::min_element(cont, Pred());
|
||||
BOOST_CHECK( result == boost::min_element(
|
||||
boost::make_iterator_range(cont), Pred()) );
|
||||
@ -78,14 +76,14 @@ namespace boost
|
||||
|
||||
Pred pred() const { return Pred(); }
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
result_t result = boost::min_element<return_type>(cont, policy.pred());
|
||||
BOOST_CHECK( result == boost::min_element<return_type>(
|
||||
boost::make_iterator_range(cont), policy.pred()) );
|
||||
@ -94,7 +92,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::min_element(cont.begin(), cont.end(), Pred());
|
||||
@ -107,9 +105,9 @@ namespace boost
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t cont;
|
||||
|
||||
@ -149,7 +147,6 @@ namespace boost
|
||||
test_min_element_impl< std::list<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -157,7 +154,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.min_element" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_min_element ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_min_element::test_min_element ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_partition
|
||||
{
|
||||
struct equal_to_5
|
||||
{
|
||||
@ -38,10 +36,10 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
|
||||
const Container old_cont(cont);
|
||||
Container cont2(old_cont);
|
||||
@ -60,14 +58,14 @@ namespace boost
|
||||
|
||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
|
||||
const Container old_cont(cont);
|
||||
Container cont2(old_cont);
|
||||
@ -86,7 +84,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::partition(cont.begin(), cont.end(), UnaryPredicate());
|
||||
@ -98,7 +96,7 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
partition_test_policy< equal_to_5 > policy;
|
||||
|
||||
@ -125,7 +123,6 @@ namespace boost
|
||||
test_partition_impl< std::deque<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -133,7 +130,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.partition" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_partition ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_partition::test_partition ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_stable_partition
|
||||
{
|
||||
struct equal_to_5
|
||||
{
|
||||
@ -38,12 +36,12 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
Container cont2(cont);
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::stable_partition(cont, UnaryPredicate());
|
||||
|
||||
iter_t temp_result = boost::stable_partition(
|
||||
@ -60,14 +58,14 @@ namespace boost
|
||||
|
||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
Container cont2(cont);
|
||||
result_t result = boost::stable_partition<return_type>(cont, policy.pred());
|
||||
|
||||
@ -82,7 +80,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::stable_partition(cont.begin(), cont.end(), UnaryPredicate());
|
||||
@ -94,7 +92,7 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
stable_partition_test_policy< equal_to_5 > policy;
|
||||
|
||||
@ -121,8 +119,6 @@ namespace boost
|
||||
test_stable_partition_impl< std::deque<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -130,7 +126,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.stable_partition" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_stable_partition ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_stable_partition::test_stable_partition ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -23,16 +23,14 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_unique
|
||||
{
|
||||
// test the 'unique' algorithm without a predicate
|
||||
class unique_test_policy
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
// There isn't an iterator return version of boost::unique, so just
|
||||
@ -40,14 +38,14 @@ namespace boost
|
||||
return std::unique(cont.begin(), cont.end());
|
||||
}
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
|
||||
Container cont2(cont);
|
||||
|
||||
@ -63,7 +61,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::unique(cont.begin(), cont.end());
|
||||
@ -76,7 +74,7 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
// There isn't an iterator return version of boost::unique, so just
|
||||
@ -86,14 +84,14 @@ namespace boost
|
||||
|
||||
Pred pred() const { return Pred(); }
|
||||
|
||||
template< range_return_value return_type >
|
||||
template< boost::range_return_value return_type >
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,return_type>::type result_t;
|
||||
|
||||
Container cont2(cont);
|
||||
|
||||
@ -109,7 +107,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::unique(cont.begin(), cont.end(), Pred());
|
||||
@ -123,7 +121,7 @@ namespace boost
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
Container cont;
|
||||
|
||||
@ -174,7 +172,6 @@ namespace boost
|
||||
test_unique_impl< std::deque<int> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int argc, char* argv[])
|
||||
@ -182,7 +179,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.unique" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_unique ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_unique::test_unique ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -21,31 +21,29 @@
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace
|
||||
namespace boost_range_test_algorithm_upper_bound
|
||||
{
|
||||
class upper_bound_policy
|
||||
{
|
||||
public:
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::upper_bound(cont, 5);
|
||||
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template<range_return_value result_type>
|
||||
template<boost::range_return_value result_type>
|
||||
struct test_range
|
||||
{
|
||||
template<class Container, class Policy>
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,result_type>::type
|
||||
operator()(Policy&, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,result_type>::type result_t;
|
||||
result_t result = boost::upper_bound<result_type>(cont, 5);
|
||||
BOOST_CHECK( result == boost::upper_bound<result_type>(boost::make_iterator_range(cont), 5) );
|
||||
return result;
|
||||
@ -53,7 +51,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::upper_bound(cont.begin(), cont.end(), 5);
|
||||
@ -64,23 +62,23 @@ namespace boost
|
||||
struct upper_bound_pred_policy
|
||||
{
|
||||
template< class Container >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
test_iter(Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type iter_t;
|
||||
iter_t result = boost::upper_bound(cont, 5, BinaryPredicate());
|
||||
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) );
|
||||
return result;
|
||||
}
|
||||
|
||||
template< range_return_value result_type>
|
||||
template< boost::range_return_value result_type>
|
||||
struct test_range
|
||||
{
|
||||
template< class Container, class Policy >
|
||||
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_return<Container,result_type>::type
|
||||
operator()(Policy& policy, Container& cont)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type result_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::range_return<Container,result_type>::type result_t;
|
||||
|
||||
result_t result = boost::upper_bound<result_type>(cont, 5, policy.pred());
|
||||
|
||||
@ -92,7 +90,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||
reference(Container& cont)
|
||||
{
|
||||
return std::upper_bound(
|
||||
@ -112,10 +110,10 @@ namespace boost
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container>::type container_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
||||
|
||||
range_test::range_return_test_driver test_driver;
|
||||
boost::range_test::range_return_test_driver test_driver;
|
||||
|
||||
container_t mcont;
|
||||
Container& cont = mcont;
|
||||
@ -159,7 +157,6 @@ namespace boost
|
||||
std::greater<int>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void test_upper_bound()
|
||||
{
|
||||
@ -179,7 +176,7 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.upper_bound" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &boost::test_upper_bound ) );
|
||||
test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_upper_bound::test_upper_bound ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
Reference in New Issue
Block a user