Skip to content

Commit a9f301b

Browse files
committed
Add erase_if testing for vector and list
1 parent 6911e6a commit a9f301b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

test/list_test.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <boost/container/detail/config_begin.hpp>
1515
#include <boost/container/detail/iterator.hpp>
16+
#include <boost/container/detail/compare_functors.hpp>
1617
#include "check_equal_containers.hpp"
1718
#include "print_container.hpp"
1819
#include "input_from_forward_iterator.hpp"
@@ -102,13 +103,22 @@ bool list_copyable_only(V1 &boostlist, V2 &stdlist, boost::container::dtl::true_
102103
stdlist.insert(stdlist.end(), aux_vect2, aux_vect2 + 50);
103104
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
104105

106+
//erase
105107
if (1 != erase(boostlist, 25))
106108
return 1;
109+
if (0 != erase(boostlist, 25))
110+
return 1;
111+
107112
stdlist.erase(boost::container::find(stdlist.begin(), stdlist.end(), 25));
108113
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
109114

110-
if (0 != erase(boostlist, 25))
115+
//erase_if
116+
if (1 != erase_if(boostlist, equal_to_value<int>(24)))
117+
return 1;
118+
if (0 != erase_if(boostlist, equal_to_value<int>(24)))
111119
return 1;
120+
stdlist.erase(boost::container::find(stdlist.begin(), stdlist.end(), 24));
121+
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
112122
}
113123
{ //List(const List &, alloc)
114124
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostlist, typename V1::allocator_type());

test/vector_test.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <boost/move/utility_core.hpp>
2121
#include <boost/container/detail/mpl.hpp>
2222
#include <boost/container/detail/algorithm.hpp>
23+
#include <boost/container/detail/compare_functors.hpp>
2324
#include <boost/move/utility_core.hpp>
2425
#include <boost/move/iterator.hpp>
2526
#include <boost/move/make_unique.hpp>
@@ -577,13 +578,21 @@ int vector_move_assignable_only(boost::container::dtl::true_type)
577578
,boost::make_move_iterator(aux_vect + 50));
578579
stdvector.insert(stdvector.end(), aux_vect2, aux_vect2 + 50);
579580

581+
//erase
580582
if (1 != erase(boostvector, 25))
581583
return 1;
584+
if (0 != erase(boostvector, 25))
585+
return 1;
582586
stdvector.erase(boost::container::find(stdvector.begin(), stdvector.end(), 25));
583587
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
584588

585-
if (0 != erase(boostvector, 25))
589+
//erase_if
590+
if (1 != erase_if(boostvector, equal_to_value<int>(24)))
586591
return 1;
592+
if (0 != erase_if(boostvector, equal_to_value<int>(24)))
593+
return 1;
594+
stdvector.erase(boost::container::find(stdvector.begin(), stdvector.end(), 24));
595+
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
587596
}
588597
return 0;
589598
}

0 commit comments

Comments
 (0)