mirror of
https://github.com/boostorg/range.git
synced 2025-07-13 20:56:44 +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 <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_find
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class find_test_policy
|
class find_test_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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 result = boost::find(cont, 3);
|
||||||
iter_t result2 = boost::find(boost::make_iterator_range(cont), 3);
|
iter_t result2 = boost::find(boost::make_iterator_range(cont), 3);
|
||||||
BOOST_CHECK( result == result2 );
|
BOOST_CHECK( result == result2 );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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 result = boost::find<return_type>(cont, 3);
|
||||||
result_t result2 = boost::find<return_type>(boost::make_iterator_range(cont), 3);
|
result_t result2 = boost::find<return_type>(boost::make_iterator_range(cont), 3);
|
||||||
BOOST_CHECK( result == result2 );
|
BOOST_CHECK( result == result2 );
|
||||||
@ -56,7 +54,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find(cont.begin(), cont.end(), 3);
|
return std::find(cont.begin(), cont.end(), 3);
|
||||||
@ -68,9 +66,9 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
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_t mcont;
|
||||||
Container& cont = mcont;
|
Container& cont = mcont;
|
||||||
@ -101,7 +99,6 @@ namespace boost
|
|||||||
std::vector<int>::const_iterator it2 = boost::find(cvi, 0);
|
std::vector<int>::const_iterator it2 = boost::find(cvi, 0);
|
||||||
BOOST_CHECK( it == it2 );
|
BOOST_CHECK( it == it2 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -110,7 +107,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_find_end
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
template<class Container2>
|
template<class Container2>
|
||||||
class find_end_test_policy
|
class find_end_test_policy
|
||||||
{
|
{
|
||||||
@ -38,10 +36,10 @@ namespace boost
|
|||||||
container2_t cont() { return m_cont; }
|
container2_t cont() { return m_cont; }
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
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(boost::make_iterator_range(cont), m_cont) );
|
||||||
BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) );
|
BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) );
|
||||||
@ -49,14 +47,14 @@ namespace boost
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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());
|
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>(boost::make_iterator_range(cont), policy.cont()) );
|
||||||
BOOST_CHECK( result == boost::find_end<return_type>(cont, boost::make_iterator_range(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>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find_end(cont.begin(), cont.end(),
|
return std::find_end(cont.begin(), cont.end(),
|
||||||
@ -92,10 +90,10 @@ namespace boost
|
|||||||
BinaryPredicate& pred() { return m_pred; }
|
BinaryPredicate& pred() { return m_pred; }
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
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(boost::make_iterator_range(cont), m_cont, m_pred) );
|
||||||
BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(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;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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());
|
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>(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()) );
|
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>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find_end(cont.begin(), cont.end(),
|
return std::find_end(cont.begin(), cont.end(),
|
||||||
@ -137,7 +135,7 @@ namespace boost
|
|||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
void run_tests(Container1& cont1, Container2& cont2)
|
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_test_policy<Container2>(cont2));
|
||||||
test_driver(cont1, find_end_pred_test_policy<Container2, std::less<int> >(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));
|
test_driver(cont2, find_end_pred_test_policy<Container2, std::greater<int> >(cont2));
|
||||||
@ -148,8 +146,8 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container1>::type container1_t;
|
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container1>::type container1_t;
|
||||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container2>::type container2_t;
|
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container2>::type container2_t;
|
||||||
|
|
||||||
container1_t mcont1;
|
container1_t mcont1;
|
||||||
Container1& cont1 = mcont1;
|
Container1& cont1 = mcont1;
|
||||||
@ -188,7 +186,6 @@ namespace boost
|
|||||||
test_find_end_impl< std::vector<int>, std::list<int> >();
|
test_find_end_impl< std::vector<int>, std::list<int> >();
|
||||||
test_find_end_impl< std::list<int>, std::vector<int> >();
|
test_find_end_impl< std::list<int>, std::vector<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -197,7 +194,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_end" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_find_first_of
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
template<class Container2>
|
template<class Container2>
|
||||||
class find_first_of_test_policy
|
class find_first_of_test_policy
|
||||||
{
|
{
|
||||||
@ -38,10 +36,10 @@ namespace boost
|
|||||||
container2_t& cont() { return m_cont; }
|
container2_t& cont() { return m_cont; }
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
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(boost::make_iterator_range(cont), m_cont) );
|
||||||
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) );
|
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) );
|
||||||
@ -49,14 +47,14 @@ namespace boost
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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());
|
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>(boost::make_iterator_range(cont), policy.cont()) );
|
||||||
BOOST_CHECK( result == boost::find_first_of<return_type>(cont, boost::make_iterator_range(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>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find_first_of(cont.begin(), cont.end(),
|
return std::find_first_of(cont.begin(), cont.end(),
|
||||||
@ -91,10 +89,10 @@ namespace boost
|
|||||||
BinaryPredicate& pred() { return m_pred; }
|
BinaryPredicate& pred() { return m_pred; }
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
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(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) );
|
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) );
|
||||||
@ -102,14 +100,14 @@ namespace boost
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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());
|
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>(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()) );
|
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>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find_first_of(cont.begin(), cont.end(),
|
return std::find_first_of(cont.begin(), cont.end(),
|
||||||
@ -135,7 +133,7 @@ namespace boost
|
|||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
void run_tests(Container1& cont1, Container2& cont2)
|
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_test_policy<Container2>(cont2));
|
||||||
test_driver(cont1, find_first_of_pred_test_policy<Container2, std::less<int> >(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));
|
test_driver(cont2, find_first_of_pred_test_policy<Container2, std::greater<int> >(cont2));
|
||||||
@ -146,8 +144,8 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container1>::type container1_t;
|
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container1>::type container1_t;
|
||||||
typedef BOOST_DEDUCED_TYPENAME remove_const<Container2>::type container2_t;
|
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Container2>::type container2_t;
|
||||||
|
|
||||||
container1_t mcont1;
|
container1_t mcont1;
|
||||||
Container1& cont1 = mcont1;
|
Container1& cont1 = mcont1;
|
||||||
@ -186,7 +184,6 @@ namespace boost
|
|||||||
test_find_first_of_impl< std::vector<int>, std::list<int> >();
|
test_find_first_of_impl< std::vector<int>, std::list<int> >();
|
||||||
test_find_first_of_impl< std::list<int>, std::vector<int> >();
|
test_find_first_of_impl< std::list<int>, std::vector<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -195,7 +192,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_first_of" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,8 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_find_if
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
template<class UnaryPredicate>
|
template<class UnaryPredicate>
|
||||||
class find_if_test_policy
|
class find_if_test_policy
|
||||||
{
|
{
|
||||||
@ -35,23 +33,23 @@ namespace boost
|
|||||||
: m_pred(pred) {}
|
: m_pred(pred) {}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::find_if(cont, m_pred);
|
||||||
BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) );
|
BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container>
|
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)
|
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());
|
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()) );
|
BOOST_CHECK( result == boost::find_if<return_type>(boost::make_iterator_range(cont), policy.pred()) );
|
||||||
return result;
|
return result;
|
||||||
@ -59,7 +57,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::find_if(cont.begin(), cont.end(), m_pred);
|
return std::find_if(cont.begin(), cont.end(), m_pred);
|
||||||
@ -84,9 +82,9 @@ namespace boost
|
|||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
using namespace boost::range_test_function;
|
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_t mcont;
|
||||||
Container& cont = mcont;
|
Container& cont = mcont;
|
||||||
@ -114,7 +112,6 @@ namespace boost
|
|||||||
test_find_if_container< const std::list<int> >();
|
test_find_if_container< const std::list<int> >();
|
||||||
test_find_if_container< const std::deque<int> >();
|
test_find_if_container< const std::deque<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -123,7 +120,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_if" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -22,31 +22,29 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_lower_bound
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class lower_bound_policy
|
class lower_bound_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::lower_bound(cont, 5);
|
||||||
BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) );
|
BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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);
|
result_t result = boost::lower_bound<return_type>(cont, 5);
|
||||||
BOOST_CHECK( result == boost::lower_bound<return_type>(boost::make_iterator_range(cont), 5) );
|
BOOST_CHECK( result == boost::lower_bound<return_type>(boost::make_iterator_range(cont), 5) );
|
||||||
return result;
|
return result;
|
||||||
@ -54,7 +52,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::lower_bound(cont.begin(), cont.end(), 5);
|
return std::lower_bound(cont.begin(), cont.end(), 5);
|
||||||
@ -65,24 +63,24 @@ namespace boost
|
|||||||
struct lower_bound_pred_policy
|
struct lower_bound_pred_policy
|
||||||
{
|
{
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::lower_bound(cont, 5, m_pred);
|
||||||
BOOST_CHECK( result == boost::lower_bound(
|
BOOST_CHECK( result == boost::lower_bound(
|
||||||
boost::make_iterator_range(cont), 5, m_pred) );
|
boost::make_iterator_range(cont), 5, m_pred) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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());
|
result_t result = boost::lower_bound<return_type>(cont, 5, policy.pred());
|
||||||
BOOST_CHECK( result == boost::lower_bound<return_type>(
|
BOOST_CHECK( result == boost::lower_bound<return_type>(
|
||||||
boost::make_iterator_range(cont), 5, policy.pred()) );
|
boost::make_iterator_range(cont), 5, policy.pred()) );
|
||||||
@ -91,7 +89,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::lower_bound(
|
return std::lower_bound(
|
||||||
@ -111,10 +109,10 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
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;
|
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_t mcont;
|
||||||
Container& cont = mcont;
|
Container& cont = mcont;
|
||||||
@ -169,17 +167,15 @@ namespace boost
|
|||||||
test_lower_bound_impl< const std::list<int> >();
|
test_lower_bound_impl< const std::list<int> >();
|
||||||
test_lower_bound_impl< const std::deque<int> >();
|
test_lower_bound_impl< const std::deque<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
init_unit_test_suite(int argc, char* argv[])
|
init_unit_test_suite(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.lower_bound" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -22,32 +22,30 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_max_element
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class max_element_test_policy
|
class max_element_test_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::max_element(cont);
|
||||||
BOOST_CHECK( result == boost::max_element(
|
BOOST_CHECK( result == boost::max_element(
|
||||||
boost::make_iterator_range(cont)) );
|
boost::make_iterator_range(cont)) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<boost::range_return_value return_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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);
|
result_t result = boost::max_element<return_type>(cont);
|
||||||
BOOST_CHECK( result == boost::max_element<return_type>(
|
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||||
boost::make_iterator_range(cont)) );
|
boost::make_iterator_range(cont)) );
|
||||||
@ -56,7 +54,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::max_element(cont.begin(), cont.end());
|
return std::max_element(cont.begin(), cont.end());
|
||||||
@ -68,10 +66,10 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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());
|
iter_t result = boost::max_element(cont, Pred());
|
||||||
BOOST_CHECK( result == boost::max_element(
|
BOOST_CHECK( result == boost::max_element(
|
||||||
boost::make_iterator_range(cont), Pred()) );
|
boost::make_iterator_range(cont), Pred()) );
|
||||||
@ -80,14 +78,14 @@ namespace boost
|
|||||||
|
|
||||||
Pred pred() const { return Pred(); }
|
Pred pred() const { return Pred(); }
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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());
|
result_t result = boost::max_element<return_type>(cont, policy.pred());
|
||||||
BOOST_CHECK( result == boost::max_element<return_type>(
|
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||||
boost::make_iterator_range(cont), policy.pred()) );
|
boost::make_iterator_range(cont), policy.pred()) );
|
||||||
@ -96,7 +94,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::max_element(cont.begin(), cont.end(), Pred());
|
return std::max_element(cont.begin(), cont.end(), Pred());
|
||||||
@ -109,9 +107,9 @@ namespace boost
|
|||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
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;
|
container_t cont;
|
||||||
|
|
||||||
@ -150,7 +148,6 @@ namespace boost
|
|||||||
test_max_element_impl< std::deque<int> >();
|
test_max_element_impl< std::deque<int> >();
|
||||||
test_max_element_impl< std::list<int> >();
|
test_max_element_impl< std::list<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -159,7 +156,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.max_element" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -22,31 +22,29 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_min_element
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class min_element_test_policy
|
class min_element_test_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::min_element(cont);
|
||||||
BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) );
|
BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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);
|
result_t result = boost::min_element<return_type>(cont);
|
||||||
BOOST_CHECK( result == boost::min_element<return_type>(boost::make_iterator_range(cont)) );
|
BOOST_CHECK( result == boost::min_element<return_type>(boost::make_iterator_range(cont)) );
|
||||||
return result;
|
return result;
|
||||||
@ -54,7 +52,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::min_element(cont.begin(), cont.end());
|
return std::min_element(cont.begin(), cont.end());
|
||||||
@ -66,10 +64,10 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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());
|
iter_t result = boost::min_element(cont, Pred());
|
||||||
BOOST_CHECK( result == boost::min_element(
|
BOOST_CHECK( result == boost::min_element(
|
||||||
boost::make_iterator_range(cont), Pred()) );
|
boost::make_iterator_range(cont), Pred()) );
|
||||||
@ -78,14 +76,14 @@ namespace boost
|
|||||||
|
|
||||||
Pred pred() const { return Pred(); }
|
Pred pred() const { return Pred(); }
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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());
|
result_t result = boost::min_element<return_type>(cont, policy.pred());
|
||||||
BOOST_CHECK( result == boost::min_element<return_type>(
|
BOOST_CHECK( result == boost::min_element<return_type>(
|
||||||
boost::make_iterator_range(cont), policy.pred()) );
|
boost::make_iterator_range(cont), policy.pred()) );
|
||||||
@ -94,7 +92,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::min_element(cont.begin(), cont.end(), Pred());
|
return std::min_element(cont.begin(), cont.end(), Pred());
|
||||||
@ -107,9 +105,9 @@ namespace boost
|
|||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t;
|
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;
|
container_t cont;
|
||||||
|
|
||||||
@ -148,7 +146,6 @@ namespace boost
|
|||||||
test_min_element_impl< std::deque<int> >();
|
test_min_element_impl< std::deque<int> >();
|
||||||
test_min_element_impl< std::list<int> >();
|
test_min_element_impl< std::list<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -157,7 +154,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.min_element" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_partition
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
struct equal_to_5
|
struct equal_to_5
|
||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
@ -38,10 +36,10 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
const Container old_cont(cont);
|
||||||
Container cont2(old_cont);
|
Container cont2(old_cont);
|
||||||
@ -60,14 +58,14 @@ namespace boost
|
|||||||
|
|
||||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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);
|
const Container old_cont(cont);
|
||||||
Container cont2(old_cont);
|
Container cont2(old_cont);
|
||||||
@ -86,7 +84,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::partition(cont.begin(), cont.end(), UnaryPredicate());
|
return std::partition(cont.begin(), cont.end(), UnaryPredicate());
|
||||||
@ -98,7 +96,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
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;
|
partition_test_policy< equal_to_5 > policy;
|
||||||
|
|
||||||
@ -124,7 +122,6 @@ namespace boost
|
|||||||
test_partition_impl< std::list<int> >();
|
test_partition_impl< std::list<int> >();
|
||||||
test_partition_impl< std::deque<int> >();
|
test_partition_impl< std::deque<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -133,7 +130,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.partition" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_stable_partition
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
struct equal_to_5
|
struct equal_to_5
|
||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
@ -38,12 +36,12 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
Container cont2(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 result = boost::stable_partition(cont, UnaryPredicate());
|
||||||
|
|
||||||
iter_t temp_result = boost::stable_partition(
|
iter_t temp_result = boost::stable_partition(
|
||||||
@ -60,14 +58,14 @@ namespace boost
|
|||||||
|
|
||||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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);
|
Container cont2(cont);
|
||||||
result_t result = boost::stable_partition<return_type>(cont, policy.pred());
|
result_t result = boost::stable_partition<return_type>(cont, policy.pred());
|
||||||
|
|
||||||
@ -82,7 +80,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::stable_partition(cont.begin(), cont.end(), UnaryPredicate());
|
return std::stable_partition(cont.begin(), cont.end(), UnaryPredicate());
|
||||||
@ -94,7 +92,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
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;
|
stable_partition_test_policy< equal_to_5 > policy;
|
||||||
|
|
||||||
@ -120,17 +118,15 @@ namespace boost
|
|||||||
test_stable_partition_impl< std::list<int> >();
|
test_stable_partition_impl< std::list<int> >();
|
||||||
test_stable_partition_impl< std::deque<int> >();
|
test_stable_partition_impl< std::deque<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
init_unit_test_suite(int argc, char* argv[])
|
init_unit_test_suite(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.stable_partition" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,14 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_unique
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
// test the 'unique' algorithm without a predicate
|
// test the 'unique' algorithm without a predicate
|
||||||
class unique_test_policy
|
class unique_test_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
// There isn't an iterator return version of boost::unique, so just
|
// 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());
|
return std::unique(cont.begin(), cont.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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);
|
Container cont2(cont);
|
||||||
|
|
||||||
@ -63,7 +61,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::unique(cont.begin(), cont.end());
|
return std::unique(cont.begin(), cont.end());
|
||||||
@ -76,7 +74,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
// There isn't an iterator return version of boost::unique, so just
|
// There isn't an iterator return version of boost::unique, so just
|
||||||
@ -86,14 +84,14 @@ namespace boost
|
|||||||
|
|
||||||
Pred pred() const { return Pred(); }
|
Pred pred() const { return Pred(); }
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< boost::range_return_value return_type >
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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);
|
Container cont2(cont);
|
||||||
|
|
||||||
@ -109,7 +107,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::unique(cont.begin(), cont.end(), Pred());
|
return std::unique(cont.begin(), cont.end(), Pred());
|
||||||
@ -123,7 +121,7 @@ namespace boost
|
|||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME Container::value_type value_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 cont;
|
Container cont;
|
||||||
|
|
||||||
@ -173,7 +171,6 @@ namespace boost
|
|||||||
test_unique_impl< std::list<int> >();
|
test_unique_impl< std::list<int> >();
|
||||||
test_unique_impl< std::deque<int> >();
|
test_unique_impl< std::deque<int> >();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::unit_test::test_suite*
|
boost::unit_test::test_suite*
|
||||||
@ -182,7 +179,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.unique" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -21,31 +21,29 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace boost
|
namespace boost_range_test_algorithm_upper_bound
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class upper_bound_policy
|
class upper_bound_policy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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);
|
iter_t result = boost::upper_bound(cont, 5);
|
||||||
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) );
|
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value result_type>
|
template<boost::range_return_value result_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template<class Container, class Policy>
|
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)
|
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);
|
result_t result = boost::upper_bound<result_type>(cont, 5);
|
||||||
BOOST_CHECK( result == boost::upper_bound<result_type>(boost::make_iterator_range(cont), 5) );
|
BOOST_CHECK( result == boost::upper_bound<result_type>(boost::make_iterator_range(cont), 5) );
|
||||||
return result;
|
return result;
|
||||||
@ -53,7 +51,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::upper_bound(cont.begin(), cont.end(), 5);
|
return std::upper_bound(cont.begin(), cont.end(), 5);
|
||||||
@ -64,23 +62,23 @@ namespace boost
|
|||||||
struct upper_bound_pred_policy
|
struct upper_bound_pred_policy
|
||||||
{
|
{
|
||||||
template< class Container >
|
template< class Container >
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
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());
|
iter_t result = boost::upper_bound(cont, 5, BinaryPredicate());
|
||||||
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) );
|
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value result_type>
|
template< boost::range_return_value result_type>
|
||||||
struct test_range
|
struct test_range
|
||||||
{
|
{
|
||||||
template< class Container, class Policy >
|
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)
|
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());
|
result_t result = boost::upper_bound<result_type>(cont, 5, policy.pred());
|
||||||
|
|
||||||
@ -92,7 +90,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME boost::range_iterator<Container>::type
|
||||||
reference(Container& cont)
|
reference(Container& cont)
|
||||||
{
|
{
|
||||||
return std::upper_bound(
|
return std::upper_bound(
|
||||||
@ -112,10 +110,10 @@ namespace boost
|
|||||||
{
|
{
|
||||||
using namespace boost::assign;
|
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;
|
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_t mcont;
|
||||||
Container& cont = mcont;
|
Container& cont = mcont;
|
||||||
@ -159,7 +157,6 @@ namespace boost
|
|||||||
std::greater<int>()
|
std::greater<int>()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void test_upper_bound()
|
void test_upper_bound()
|
||||||
{
|
{
|
||||||
@ -179,7 +176,7 @@ init_unit_test_suite(int argc, char* argv[])
|
|||||||
boost::unit_test::test_suite* test
|
boost::unit_test::test_suite* test
|
||||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm.upper_bound" );
|
= 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;
|
return test;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user