mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 06:24:26 +02:00
Add iterator tests
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "vector_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -426,7 +427,18 @@ int main ()
|
||||
< boost::container::deque<int> >()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::deque<int> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "container_common_tests.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -498,6 +499,26 @@ int main()
|
||||
if(!boost::container::test::test_propagate_allocator<boost_container_flat_multimap>())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::flat_map<int, int> cont_int;
|
||||
cont_int a; a.insert(cont_int::value_type(0, 9)); a.insert(cont_int::value_type(1, 9)); a.insert(cont_int::value_type(2, 9));
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
typedef boost::container::flat_multimap<int, int> cont_int;
|
||||
cont_int a; a.insert(cont_int::value_type(0, 9)); a.insert(cont_int::value_type(1, 9)); a.insert(cont_int::value_type(2, 9));
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "container_common_tests.hpp"
|
||||
#include <vector>
|
||||
#include <boost/container/detail/flat_tree.hpp>
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -272,6 +273,24 @@ bool flat_tree_ordered_insertion_test()
|
||||
int_mset4.insert(int_even_mset.begin(), int_even_mset.end());
|
||||
if(!CheckEqualContainers(int_mset4, fmset))
|
||||
return false;
|
||||
|
||||
//Re-re-insertion using in-place merge
|
||||
fmset.reserve(fmset.size() + int_mset2.size());
|
||||
fmset.insert(ordered_range, int_mset2.begin(), int_mset2.end());
|
||||
std::multiset<int> int_mset5(int_mset2);
|
||||
int_mset4.insert(int_mset5.begin(), int_mset5.end());
|
||||
if(!CheckEqualContainers(int_mset4, fmset))
|
||||
return false;
|
||||
//Re-re-insertion of even
|
||||
std::multiset<int> int_even_mset2;
|
||||
for(std::size_t i = 0; i < NumElements; i+=2){
|
||||
int_even_mset2.insert(static_cast<int>(i));
|
||||
}
|
||||
fmset.reserve(fmset.size() + int_even_mset2.size());
|
||||
fmset.insert(ordered_range, int_even_mset2.begin(), int_even_mset2.end());
|
||||
int_mset4.insert(int_even_mset2.begin(), int_even_mset2.end());
|
||||
if(!CheckEqualContainers(int_mset4, fmset))
|
||||
return false;
|
||||
}
|
||||
|
||||
//Ordered insertion set
|
||||
@@ -605,6 +624,26 @@ int main()
|
||||
if(!boost::container::test::test_propagate_allocator<boost_container_flat_multiset>())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::flat_set<int> cont_int;
|
||||
cont_int a; a.insert(0); a.insert(1); a.insert(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
typedef boost::container::flat_multiset<int> cont_int;
|
||||
cont_int a; a.insert(0); a.insert(1); a.insert(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "list_test.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -220,20 +221,25 @@ int main ()
|
||||
if(!boost::container::test::test_propagate_allocator<boost_container_list>())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Initializer lists
|
||||
////////////////////////////////////
|
||||
if(!test_support_for_initializer_list())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::list<int> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_bidirectional< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
/*
|
||||
#include <boost/container/list.hpp>
|
||||
//#include <list>
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "map_test.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -434,6 +435,26 @@ int main ()
|
||||
if (!boost::container::test::test_map_support_for_initialization_list_for<multimap<int, int> >())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::map<int, int> cont_int;
|
||||
cont_int a; a.insert(cont_int::value_type(0, 9)); a.insert(cont_int::value_type(1, 9)); a.insert(cont_int::value_type(2, 9));
|
||||
boost::intrusive::test::test_iterator_bidirectional< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
typedef boost::container::multimap<int, int> cont_int;
|
||||
cont_int a; a.insert(cont_int::value_type(0, 9)); a.insert(cont_int::value_type(1, 9)); a.insert(cont_int::value_type(2, 9));
|
||||
boost::intrusive::test::test_iterator_bidirectional< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Test optimize_size option
|
||||
////////////////////////////////////
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "set_test.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -439,6 +440,26 @@ int main ()
|
||||
typedef multiset< int*, std::less<int*>, std::allocator<int*>
|
||||
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmset_size_optimized_yes;
|
||||
BOOST_STATIC_ASSERT(sizeof(avlmset_size_optimized_yes) < sizeof(avlmset_size_optimized_no));
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::set<int> cont_int;
|
||||
cont_int a; a.insert(0); a.insert(1); a.insert(2);
|
||||
boost::intrusive::test::test_iterator_bidirectional< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
typedef boost::container::multiset<int> cont_int;
|
||||
cont_int a; a.insert(0); a.insert(1); a.insert(2);
|
||||
boost::intrusive::test::test_iterator_bidirectional< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "list_test.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -228,8 +229,23 @@ int main ()
|
||||
if(!boost::container::test::test_propagate_allocator<boost_container_slist>())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Initializer lists
|
||||
////////////////////////////////////
|
||||
if(!test_support_for_initializer_list())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::slist<int> vector_int;
|
||||
vector_int a; a.push_front(2); a.push_front(1); a.push_front(0);
|
||||
boost::intrusive::test::test_iterator_forward< boost::container::slist<int> >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "movable_int.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
#include <boost/container/allocator.hpp>
|
||||
#include <boost/container/node_allocator.hpp>
|
||||
@@ -179,5 +180,17 @@ int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::small_vector<int, 0> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "vector_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -206,6 +207,18 @@ int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::stable_vector<int> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/container/stable_vector.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
@@ -811,6 +812,15 @@ int main(int, char* [])
|
||||
|
||||
test_support_for_initializer_list();
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::static_vector<int, 3> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "expand_bwd_test_template.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -483,6 +484,26 @@ int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::basic_string<char> cont_int;
|
||||
cont_int a; a.push_back(char(1)); a.push_back(char(2)); a.push_back(char(3));
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
typedef boost::container::basic_string<wchar_t> cont_int;
|
||||
cont_int a; a.push_back(wchar_t(1)); a.push_back(wchar_t(2)); a.push_back(wchar_t(3));
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "vector_test.hpp"
|
||||
#include "default_init_test.hpp"
|
||||
#include "../../intrusive/test/iterator_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
@@ -263,6 +264,17 @@ int main()
|
||||
>()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
////////////////////////////////////
|
||||
// Iterator testing
|
||||
////////////////////////////////////
|
||||
{
|
||||
typedef boost::container::vector<int> cont_int;
|
||||
cont_int a; a.push_back(0); a.push_back(1); a.push_back(2);
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
if(boost::report_errors() != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user