mirror of
https://github.com/boostorg/container.git
synced 2026-01-19 04:02:17 +00:00
Add erase_if testing for vector and list
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/compare_functors.hpp>
|
||||
#include "check_equal_containers.hpp"
|
||||
#include "print_container.hpp"
|
||||
#include "input_from_forward_iterator.hpp"
|
||||
@@ -102,13 +103,22 @@ bool list_copyable_only(V1 &boostlist, V2 &stdlist, boost::container::dtl::true_
|
||||
stdlist.insert(stdlist.end(), aux_vect2, aux_vect2 + 50);
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||
|
||||
//erase
|
||||
if (1 != erase(boostlist, 25))
|
||||
return 1;
|
||||
if (0 != erase(boostlist, 25))
|
||||
return 1;
|
||||
|
||||
stdlist.erase(boost::container::find(stdlist.begin(), stdlist.end(), 25));
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||
|
||||
if (0 != erase(boostlist, 25))
|
||||
//erase_if
|
||||
if (1 != erase_if(boostlist, equal_to_value<int>(24)))
|
||||
return 1;
|
||||
if (0 != erase_if(boostlist, equal_to_value<int>(24)))
|
||||
return 1;
|
||||
stdlist.erase(boost::container::find(stdlist.begin(), stdlist.end(), 24));
|
||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||
}
|
||||
{ //List(const List &, alloc)
|
||||
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostlist, typename V1::allocator_type());
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp>
|
||||
#include <boost/container/detail/compare_functors.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
@@ -577,13 +578,21 @@ int vector_move_assignable_only(boost::container::dtl::true_type)
|
||||
,boost::make_move_iterator(aux_vect + 50));
|
||||
stdvector.insert(stdvector.end(), aux_vect2, aux_vect2 + 50);
|
||||
|
||||
//erase
|
||||
if (1 != erase(boostvector, 25))
|
||||
return 1;
|
||||
if (0 != erase(boostvector, 25))
|
||||
return 1;
|
||||
stdvector.erase(boost::container::find(stdvector.begin(), stdvector.end(), 25));
|
||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
|
||||
|
||||
if (0 != erase(boostvector, 25))
|
||||
//erase_if
|
||||
if (1 != erase_if(boostvector, equal_to_value<int>(24)))
|
||||
return 1;
|
||||
if (0 != erase_if(boostvector, equal_to_value<int>(24)))
|
||||
return 1;
|
||||
stdvector.erase(boost::container::find(stdvector.begin(), stdvector.end(), 24));
|
||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user