forked from boostorg/container
Refactor big test into smaller tests
This commit is contained in:
@ -35,20 +35,6 @@
|
|||||||
|
|
||||||
using namespace boost::container;
|
using namespace boost::container;
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace container {
|
|
||||||
|
|
||||||
//Explicit instantiation to detect compilation errors
|
|
||||||
template class boost::container::deque
|
|
||||||
< test::movable_and_copyable_int
|
|
||||||
, test::simple_allocator<test::movable_and_copyable_int> >;
|
|
||||||
|
|
||||||
template class boost::container::deque
|
|
||||||
< test::movable_and_copyable_int
|
|
||||||
, allocator<test::movable_and_copyable_int> >;
|
|
||||||
|
|
||||||
}}
|
|
||||||
|
|
||||||
//Function to check if both sets are equal
|
//Function to check if both sets are equal
|
||||||
template<class V1, class V2>
|
template<class V1, class V2>
|
||||||
bool deque_copyable_only(V1 &, V2 &, dtl::false_type)
|
bool deque_copyable_only(V1 &, V2 &, dtl::false_type)
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <boost/container/deque.hpp>
|
#include <boost/container/deque.hpp>
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
|
||||||
struct empty
|
struct empty
|
||||||
{
|
{
|
||||||
@ -18,9 +22,25 @@ struct empty
|
|||||||
|
|
||||||
template class ::boost::container::deque<empty>;
|
template class ::boost::container::deque<empty>;
|
||||||
|
|
||||||
|
volatile ::boost::container::deque<empty> dummy;
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
template class boost::container::deque
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::simple_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
template class boost::container::deque
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
} //namespace boost {
|
||||||
|
} //namespace container {
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::deque<empty> dummy;
|
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <boost/container/flat_map.hpp>
|
#include <boost/container/flat_map.hpp>
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
#include <boost/container/stable_vector.hpp>
|
||||||
|
#include <boost/container/small_vector.hpp>
|
||||||
|
#include <boost/container/deque.hpp>
|
||||||
|
#include <boost/container/static_vector.hpp>
|
||||||
|
|
||||||
struct empty
|
struct empty
|
||||||
{
|
{
|
||||||
@ -19,10 +26,69 @@ struct empty
|
|||||||
template class ::boost::container::flat_map<empty, empty>;
|
template class ::boost::container::flat_map<empty, empty>;
|
||||||
template class ::boost::container::flat_multimap<empty, empty>;
|
template class ::boost::container::flat_multimap<empty, empty>;
|
||||||
|
|
||||||
|
volatile ::boost::container::flat_map<empty, empty> dummy;
|
||||||
|
volatile ::boost::container::flat_multimap<empty, empty> dummy2;
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
|
||||||
|
//flat_map
|
||||||
|
typedef std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> test_pair_t;
|
||||||
|
|
||||||
|
template class flat_map
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, small_vector< test_pair_t, 10, std::allocator< test_pair_t > >
|
||||||
|
>;
|
||||||
|
|
||||||
|
//flat_multimap
|
||||||
|
template class flat_multimap
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, stable_vector< test_pair_t, allocator< test_pair_t > >
|
||||||
|
>;
|
||||||
|
|
||||||
|
template class flat_multimap
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, deque<test_pair_t, test::simple_allocator< test_pair_t > >
|
||||||
|
>;
|
||||||
|
|
||||||
|
template class flat_multimap
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, static_vector<test_pair_t, 10 >
|
||||||
|
>;
|
||||||
|
|
||||||
|
//As flat container iterators are typedefs for vector::[const_]iterator,
|
||||||
|
//no need to explicit instantiate them
|
||||||
|
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
|
#if (__cplusplus > 201103L)
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace boost{
|
||||||
|
namespace container{
|
||||||
|
|
||||||
|
template class flat_map
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, std::vector<test_pair_t>
|
||||||
|
>;
|
||||||
|
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::flat_map<empty, empty> dummy;
|
|
||||||
::boost::container::flat_multimap<empty, empty> dummy2;
|
|
||||||
(void)dummy; (void)dummy2;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,70 @@ struct empty
|
|||||||
template class ::boost::container::flat_set<empty>;
|
template class ::boost::container::flat_set<empty>;
|
||||||
template class ::boost::container::flat_multiset<empty>;
|
template class ::boost::container::flat_multiset<empty>;
|
||||||
|
|
||||||
|
volatile ::boost::container::flat_set<empty> dummy;
|
||||||
|
volatile ::boost::container::flat_multiset<empty> dummy2;
|
||||||
|
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
#include <boost/container/stable_vector.hpp>
|
||||||
|
#include <boost/container/small_vector.hpp>
|
||||||
|
#include <boost/container/deque.hpp>
|
||||||
|
#include <boost/container/static_vector.hpp>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
|
||||||
|
//flat_set
|
||||||
|
template class flat_set
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, small_vector<test::movable_and_copyable_int, 10, allocator<test::movable_and_copyable_int> >
|
||||||
|
>;
|
||||||
|
|
||||||
|
//flat_multiset
|
||||||
|
template class flat_multiset
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, stable_vector<test::movable_and_copyable_int, test::simple_allocator<test::movable_and_copyable_int> >
|
||||||
|
>;
|
||||||
|
|
||||||
|
template class flat_multiset
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, deque<test::movable_and_copyable_int, test::simple_allocator< test::movable_and_copyable_int > >
|
||||||
|
>;
|
||||||
|
|
||||||
|
template class flat_multiset
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, static_vector<test::movable_and_copyable_int, 10 >
|
||||||
|
>;
|
||||||
|
|
||||||
|
//As flat container iterators are typedefs for vector::[const_]iterator,
|
||||||
|
//no need to explicit instantiate them
|
||||||
|
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
|
#if (__cplusplus > 201103L)
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace boost{
|
||||||
|
namespace container{
|
||||||
|
|
||||||
|
template class flat_set
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, std::vector<test::movable_and_copyable_int>
|
||||||
|
>;
|
||||||
|
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::flat_set<empty> dummy;
|
|
||||||
::boost::container::flat_multiset<empty> dummy2;
|
|
||||||
(void)dummy; (void)dummy2;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,5 @@ template class ::boost::container::list<empty>;
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::list<empty> dummy;
|
::boost::container::list<empty> dummy;
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,38 @@ struct empty
|
|||||||
template class ::boost::container::map<empty, empty>;
|
template class ::boost::container::map<empty, empty>;
|
||||||
template class ::boost::container::multimap<empty, empty>;
|
template class ::boost::container::multimap<empty, empty>;
|
||||||
|
|
||||||
|
volatile ::boost::container::map<empty, empty> dummy;
|
||||||
|
volatile ::boost::container::multimap<empty, empty> dummy2;
|
||||||
|
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include <boost/container/adaptive_pool.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
typedef std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> pair_t;
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
|
||||||
|
//map
|
||||||
|
template class map
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, test::simple_allocator< pair_t >
|
||||||
|
>;
|
||||||
|
|
||||||
|
template class map
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, adaptive_pool< pair_t >
|
||||||
|
>;
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::map<empty, empty> dummy;
|
|
||||||
::boost::container::multimap<empty, empty> dummy2;
|
|
||||||
(void)dummy; (void)dummy2;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,36 @@ struct empty
|
|||||||
template class ::boost::container::set<empty>;
|
template class ::boost::container::set<empty>;
|
||||||
template class ::boost::container::multiset<empty>;
|
template class ::boost::container::multiset<empty>;
|
||||||
|
|
||||||
|
volatile ::boost::container::set<empty> dummy;
|
||||||
|
volatile ::boost::container::multiset<empty> dummy2;
|
||||||
|
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include <boost/container/adaptive_pool.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
|
||||||
|
//set
|
||||||
|
template class set
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, test::simple_allocator<test::movable_and_copyable_int>
|
||||||
|
>;
|
||||||
|
|
||||||
|
//multiset
|
||||||
|
template class multiset
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, std::less<test::movable_and_copyable_int>
|
||||||
|
, adaptive_pool<test::movable_and_copyable_int>
|
||||||
|
>;
|
||||||
|
|
||||||
|
}} //boost::container
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::set<empty> dummy;
|
|
||||||
::boost::container::multiset<empty> dummy2;
|
|
||||||
(void)dummy; (void)dummy2;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,28 @@ struct empty
|
|||||||
};
|
};
|
||||||
|
|
||||||
template class ::boost::container::slist<empty>;
|
template class ::boost::container::slist<empty>;
|
||||||
|
volatile ::boost::container::slist<empty> dummy;
|
||||||
|
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include <boost/container/node_allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
template class boost::container::slist
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, test::simple_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
template class boost::container::slist
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, node_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::slist<empty> dummy;
|
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,40 @@ struct empty
|
|||||||
};
|
};
|
||||||
|
|
||||||
template class ::boost::container::small_vector<empty, 2>;
|
template class ::boost::container::small_vector<empty, 2>;
|
||||||
|
volatile ::boost::container::small_vector<empty, 2> dummy;
|
||||||
|
|
||||||
|
#include <boost/container/allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
template class small_vector<char, 0>;
|
||||||
|
template class small_vector<char, 1>;
|
||||||
|
template class small_vector<char, 2>;
|
||||||
|
template class small_vector<char, 10>;
|
||||||
|
|
||||||
|
template class small_vector<int, 0>;
|
||||||
|
template class small_vector<int, 1>;
|
||||||
|
template class small_vector<int, 2>;
|
||||||
|
template class small_vector<int, 10>;
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
template class boost::container::small_vector
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, 10
|
||||||
|
, test::simple_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
template class boost::container::small_vector
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, 10
|
||||||
|
, allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::small_vector<empty, 2> dummy;
|
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,29 @@ struct empty
|
|||||||
};
|
};
|
||||||
|
|
||||||
template class ::boost::container::stable_vector<empty>;
|
template class ::boost::container::stable_vector<empty>;
|
||||||
|
volatile ::boost::container::stable_vector<empty> dummy;
|
||||||
|
|
||||||
|
#include <boost/container/node_allocator.hpp>
|
||||||
|
#include "movable_int.hpp"
|
||||||
|
#include "dummy_test_allocator.hpp"
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
template class stable_vector<test::movable_and_copyable_int,
|
||||||
|
test::simple_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
template class stable_vector
|
||||||
|
< test::movable_and_copyable_int
|
||||||
|
, node_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
|
template class stable_vector_iterator<int*, false>;
|
||||||
|
template class stable_vector_iterator<int*, true >;
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::stable_vector<empty> dummy;
|
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,17 @@ struct empty
|
|||||||
};
|
};
|
||||||
|
|
||||||
template class ::boost::container::static_vector<empty, 2>;
|
template class ::boost::container::static_vector<empty, 2>;
|
||||||
|
volatile ::boost::container::static_vector<empty, 2> dummy;
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace container {
|
||||||
|
|
||||||
|
//Explicit instantiation to detect compilation errors
|
||||||
|
template class boost::container::static_vector<int, 10>;
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
::boost::container::static_vector<empty, 2> dummy;
|
|
||||||
(void)dummy;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(has_member_rebalance, rebalance)
|
|||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
const int MaxElem = 50;
|
||||||
|
|
||||||
template<class T1, class T2, class T3, class T4>
|
template<class T1, class T2, class T3, class T4>
|
||||||
bool operator ==(std::pair<T1, T2> &p1, std::pair<T1, T2> &p2)
|
bool operator ==(std::pair<T1, T2> &p1, std::pair<T1, T2> &p2)
|
||||||
{
|
{
|
||||||
@ -68,8 +70,6 @@ int map_test_copyable(boost::container::dtl::true_type)
|
|||||||
typedef dtl::pair<IntType, IntType> IntPairType;
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
typedef typename MyStdMap::value_type StdPairType;
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
const int MaxElem = 50;
|
|
||||||
|
|
||||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>();
|
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>();
|
||||||
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>();
|
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>();
|
||||||
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
||||||
@ -133,17 +133,14 @@ template<class MyBoostMap
|
|||||||
,class MyStdMap
|
,class MyStdMap
|
||||||
,class MyBoostMultiMap
|
,class MyBoostMultiMap
|
||||||
,class MyStdMultiMap>
|
,class MyStdMultiMap>
|
||||||
int map_test()
|
int map_test_range()
|
||||||
{
|
{
|
||||||
typedef typename MyBoostMap::key_type IntType;
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
typedef dtl::pair<IntType, IntType> IntPairType;
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
typedef typename MyStdMap::value_type StdPairType;
|
|
||||||
const int MaxElem = 50;
|
|
||||||
typedef typename MyStdMap::value_type StdValueType;
|
typedef typename MyStdMap::value_type StdValueType;
|
||||||
typedef typename MyStdMap::key_type StdKeyType;
|
typedef typename MyStdMap::key_type StdKeyType;
|
||||||
typedef typename MyStdMap::mapped_type StdMappedType;
|
typedef typename MyStdMap::mapped_type StdMappedType;
|
||||||
|
|
||||||
|
|
||||||
//Test construction from a range
|
//Test construction from a range
|
||||||
{
|
{
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[MaxElem];
|
||||||
@ -213,15 +210,18 @@ int map_test()
|
|||||||
(&aux_vect2[0], &aux_vect2[0] + MaxElem, typename MyStdMap::key_compare());
|
(&aux_vect2[0], &aux_vect2[0] + MaxElem, typename MyStdMap::key_compare());
|
||||||
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
if(!CheckEqualContainers(*pboostmultimap, *pstdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>();
|
|
||||||
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>();
|
template<class MyBoostMap
|
||||||
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
,class MyStdMap
|
||||||
::boost::movelib::unique_ptr<MyStdMultiMap> const pstdmultimap = ::boost::movelib::make_unique<MyStdMultiMap>();
|
,class MyBoostMultiMap
|
||||||
MyBoostMap &boostmap = *pboostmap;
|
,class MyStdMultiMap>
|
||||||
MyStdMap &stdmap = *pstdmap;
|
int map_test_step(MyBoostMap &, MyStdMap &, MyBoostMultiMap &, MyStdMultiMap &)
|
||||||
MyBoostMultiMap &boostmultimap = *pboostmultimap;
|
{
|
||||||
MyStdMultiMap &stdmultimap = *pstdmultimap;
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
@ -265,6 +265,8 @@ int map_test()
|
|||||||
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
||||||
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ordered range insertion
|
//ordered range insertion
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
@ -342,6 +344,19 @@ int map_test()
|
|||||||
stdmap2[0] = 1;
|
stdmap2[0] = 1;
|
||||||
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_insert(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[MaxElem];
|
IntPairType aux_vect[MaxElem];
|
||||||
@ -401,6 +416,19 @@ int map_test()
|
|||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_erase(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
//Insertion from other container
|
//Insertion from other container
|
||||||
//Initialize values
|
//Initialize values
|
||||||
{
|
{
|
||||||
@ -489,165 +517,189 @@ int map_test()
|
|||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_insert2(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
|
//This is really nasty, but we have no other simple choice
|
||||||
|
IntPairType aux_vect[MaxElem];
|
||||||
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
IntPairType aux_vect3[MaxElem];
|
||||||
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
|
boostmap.insert(boost::move(aux_vect[i]));
|
||||||
|
stdmap.insert(StdPairType(i, i));
|
||||||
|
boostmultimap.insert(boost::move(aux_vect3[i]));
|
||||||
|
stdmultimap.insert(StdPairType(i, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
|
|
||||||
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
|
IntPairType intpair;
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
boostmap.insert(boostmap.begin(), boost::move(intpair));
|
||||||
|
stdmap.insert(stdmap.begin(), StdPairType(i, i));
|
||||||
|
//PrintContainers(boostmap, stdmap);
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
boostmultimap.insert(boostmultimap.begin(), boost::move(intpair));
|
||||||
|
stdmultimap.insert(stdmultimap.begin(), StdPairType(i, i));
|
||||||
|
//PrintContainers(boostmultimap, stdmultimap);
|
||||||
|
if(!CheckEqualPairContainers(boostmap, stdmap))
|
||||||
|
return 1;
|
||||||
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
boostmap.insert(boostmap.end(), boost::move(intpair));
|
||||||
|
stdmap.insert(stdmap.end(), StdPairType(i, i));
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
boostmultimap.insert(boostmultimap.end(), boost::move(intpair));
|
||||||
|
stdmultimap.insert(stdmultimap.end(), StdPairType(i, i));
|
||||||
|
if(!CheckEqualPairContainers(boostmap, stdmap))
|
||||||
|
return 1;
|
||||||
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
IntType k(i);
|
||||||
|
boostmap.insert(boostmap.lower_bound(k), boost::move(intpair));
|
||||||
|
stdmap.insert(stdmap.lower_bound(i), StdPairType(i, i));
|
||||||
|
//PrintContainers(boostmap, stdmap);
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
boostmultimap.insert(boostmultimap.lower_bound(boost::move(i1)), boost::move(intpair));
|
||||||
|
stdmultimap.insert(stdmultimap.lower_bound(i), StdPairType(i, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
//PrintContainers(boostmultimap, stdmultimap);
|
||||||
|
if(!CheckEqualPairContainers(boostmap, stdmap))
|
||||||
|
return 1;
|
||||||
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
{ //Check equal_range
|
||||||
|
std::pair<typename MyBoostMultiMap::iterator, typename MyBoostMultiMap::iterator> bret =
|
||||||
|
boostmultimap.equal_range(boostmultimap.begin()->first);
|
||||||
|
|
||||||
|
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> sret =
|
||||||
|
stdmultimap.equal_range(stdmultimap.begin()->first);
|
||||||
|
|
||||||
|
if( boost::container::iterator_distance(bret.first, bret.second) !=
|
||||||
|
boost::container::iterator_distance(sret.first, sret.second) ){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
boostmap.insert(boostmap.upper_bound(boost::move(i1)), boost::move(intpair));
|
||||||
|
stdmap.insert(stdmap.upper_bound(i), StdPairType(i, i));
|
||||||
|
}
|
||||||
|
//PrintContainers(boostmap, stdmap);
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
IntType i2(i);
|
||||||
|
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IntType i1(i);
|
||||||
|
boostmultimap.insert(boostmultimap.upper_bound(boost::move(i1)), boost::move(intpair));
|
||||||
|
stdmultimap.insert(stdmultimap.upper_bound(i), StdPairType(i, i));
|
||||||
|
}
|
||||||
|
//PrintContainers(boostmultimap, stdmultimap);
|
||||||
|
if(!CheckEqualPairContainers(boostmap, stdmap))
|
||||||
|
return 1;
|
||||||
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
map_test_rebalanceable(boostmap
|
||||||
|
, dtl::bool_<has_member_rebalance<MyBoostMap>::value>());
|
||||||
|
if(!CheckEqualContainers(boostmap, stdmap)){
|
||||||
|
std::cout << "Error in boostmap.rebalance()" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
map_test_rebalanceable(boostmultimap
|
||||||
|
, dtl::bool_<has_member_rebalance<MyBoostMap>::value>());
|
||||||
|
if(!CheckEqualContainers(boostmultimap, stdmultimap)){
|
||||||
|
std::cout << "Error in boostmultimap.rebalance()" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_search(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
|
||||||
|
//Compare count/contains with std containers
|
||||||
|
for(int i = 0; i < MaxElem; ++i){
|
||||||
|
IntType k(i);
|
||||||
|
if(boostmap.count(k) != stdmap.count(i)){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boostmap.contains(k) != (stdmap.find(i) != stdmap.end())){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boostmultimap.count(k) != stdmultimap.count(i)){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boostmultimap.contains(k) != (stdmultimap.find(i) != stdmultimap.end())){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
|
||||||
IntPairType aux_vect[MaxElem];
|
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
IntPairType aux_vect3[MaxElem];
|
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&aux_vect3[i])IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
|
||||||
boostmap.insert(boost::move(aux_vect[i]));
|
|
||||||
stdmap.insert(StdPairType(i, i));
|
|
||||||
boostmultimap.insert(boost::move(aux_vect3[i]));
|
|
||||||
stdmultimap.insert(StdPairType(i, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
|
||||||
|
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
|
||||||
IntPairType intpair;
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
boostmap.insert(boostmap.begin(), boost::move(intpair));
|
|
||||||
stdmap.insert(stdmap.begin(), StdPairType(i, i));
|
|
||||||
//PrintContainers(boostmap, stdmap);
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
boostmultimap.insert(boostmultimap.begin(), boost::move(intpair));
|
|
||||||
stdmultimap.insert(stdmultimap.begin(), StdPairType(i, i));
|
|
||||||
//PrintContainers(boostmultimap, stdmultimap);
|
|
||||||
if(!CheckEqualPairContainers(boostmap, stdmap))
|
|
||||||
return 1;
|
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
|
||||||
return 1;
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
boostmap.insert(boostmap.end(), boost::move(intpair));
|
|
||||||
stdmap.insert(stdmap.end(), StdPairType(i, i));
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
boostmultimap.insert(boostmultimap.end(), boost::move(intpair));
|
|
||||||
stdmultimap.insert(stdmultimap.end(), StdPairType(i, i));
|
|
||||||
if(!CheckEqualPairContainers(boostmap, stdmap))
|
|
||||||
return 1;
|
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
|
||||||
return 1;
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
IntType k(i);
|
|
||||||
boostmap.insert(boostmap.lower_bound(k), boost::move(intpair));
|
|
||||||
stdmap.insert(stdmap.lower_bound(i), StdPairType(i, i));
|
|
||||||
//PrintContainers(boostmap, stdmap);
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
boostmultimap.insert(boostmultimap.lower_bound(boost::move(i1)), boost::move(intpair));
|
|
||||||
stdmultimap.insert(stdmultimap.lower_bound(i), StdPairType(i, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
//PrintContainers(boostmultimap, stdmultimap);
|
|
||||||
if(!CheckEqualPairContainers(boostmap, stdmap))
|
|
||||||
return 1;
|
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
|
||||||
return 1;
|
|
||||||
{ //Check equal_range
|
|
||||||
std::pair<typename MyBoostMultiMap::iterator, typename MyBoostMultiMap::iterator> bret =
|
|
||||||
boostmultimap.equal_range(boostmultimap.begin()->first);
|
|
||||||
|
|
||||||
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> sret =
|
|
||||||
stdmultimap.equal_range(stdmultimap.begin()->first);
|
|
||||||
|
|
||||||
if( boost::container::iterator_distance(bret.first, bret.second) !=
|
|
||||||
boost::container::iterator_distance(sret.first, sret.second) ){
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
boostmap.insert(boostmap.upper_bound(boost::move(i1)), boost::move(intpair));
|
|
||||||
stdmap.insert(stdmap.upper_bound(i), StdPairType(i, i));
|
|
||||||
}
|
|
||||||
//PrintContainers(boostmap, stdmap);
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
IntType i2(i);
|
|
||||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IntType i1(i);
|
|
||||||
boostmultimap.insert(boostmultimap.upper_bound(boost::move(i1)), boost::move(intpair));
|
|
||||||
stdmultimap.insert(stdmultimap.upper_bound(i), StdPairType(i, i));
|
|
||||||
}
|
|
||||||
//PrintContainers(boostmultimap, stdmultimap);
|
|
||||||
if(!CheckEqualPairContainers(boostmap, stdmap))
|
|
||||||
return 1;
|
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
map_test_rebalanceable(boostmap
|
|
||||||
, dtl::bool_<has_member_rebalance<MyBoostMap>::value>());
|
|
||||||
if(!CheckEqualContainers(boostmap, stdmap)){
|
|
||||||
std::cout << "Error in boostmap.rebalance()" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
map_test_rebalanceable(boostmultimap
|
|
||||||
, dtl::bool_<has_member_rebalance<MyBoostMap>::value>());
|
|
||||||
if(!CheckEqualContainers(boostmultimap, stdmultimap)){
|
|
||||||
std::cout << "Error in boostmultimap.rebalance()" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Compare count/contains with std containers
|
|
||||||
for(int i = 0; i < MaxElem; ++i){
|
|
||||||
IntType k(i);
|
|
||||||
if(boostmap.count(k) != stdmap.count(i)){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(boostmap.contains(k) != (stdmap.find(i) != stdmap.end())){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(boostmultimap.count(k) != stdmultimap.count(i)){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(boostmultimap.contains(k) != (stdmultimap.find(i) != stdmultimap.end())){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Now do count exercise
|
//Now do count exercise
|
||||||
boostmap.erase(boostmap.begin(), boostmap.end());
|
boostmap.erase(boostmap.begin(), boostmap.end());
|
||||||
boostmultimap.erase(boostmultimap.begin(), boostmultimap.end());
|
boostmultimap.erase(boostmultimap.begin(), boostmultimap.end());
|
||||||
@ -675,6 +727,18 @@ int map_test()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_indexing(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
|
||||||
{ //operator[] test
|
{ //operator[] test
|
||||||
boostmap.clear();
|
boostmap.clear();
|
||||||
boostmultimap.clear();
|
boostmultimap.clear();
|
||||||
@ -696,6 +760,19 @@ int map_test()
|
|||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_insert_or_assign(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
|
||||||
{ //insert_or_assign test
|
{ //insert_or_assign test
|
||||||
boostmap.clear();
|
boostmap.clear();
|
||||||
@ -733,8 +810,19 @@ int map_test()
|
|||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
{ //try_emplace
|
template< class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_try_emplace(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
|
||||||
|
{ //try_emplace
|
||||||
boostmap.clear();
|
boostmap.clear();
|
||||||
boostmultimap.clear();
|
boostmultimap.clear();
|
||||||
stdmap.clear();
|
stdmap.clear();
|
||||||
@ -802,7 +890,20 @@ int map_test()
|
|||||||
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template< class MyBoostMap
|
||||||
|
, class MyStdMap
|
||||||
|
, class MyBoostMultiMap
|
||||||
|
, class MyStdMultiMap>
|
||||||
|
int map_test_merge(MyBoostMap &boostmap, MyStdMap &stdmap, MyBoostMultiMap &boostmultimap, MyStdMultiMap &stdmultimap)
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
typedef dtl::pair<IntType, IntType> IntPairType;
|
||||||
|
typedef typename MyStdMap::value_type StdPairType;
|
||||||
|
|
||||||
{ //merge
|
{ //merge
|
||||||
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap2 = ::boost::movelib::make_unique<MyBoostMap>();
|
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap2 = ::boost::movelib::make_unique<MyBoostMap>();
|
||||||
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap2 = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap2 = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
||||||
@ -904,6 +1005,56 @@ int map_test()
|
|||||||
boostmultimap.merge(boostmap2);
|
boostmultimap.merge(boostmap2);
|
||||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class MyBoostMap
|
||||||
|
,class MyStdMap
|
||||||
|
,class MyBoostMultiMap
|
||||||
|
,class MyStdMultiMap>
|
||||||
|
int map_test()
|
||||||
|
{
|
||||||
|
typedef typename MyBoostMap::key_type IntType;
|
||||||
|
|
||||||
|
if(map_test_range<MyBoostMap, MyStdMap, MyBoostMultiMap, MyStdMultiMap>())
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
::boost::movelib::unique_ptr<MyBoostMap> const pboostmap = ::boost::movelib::make_unique<MyBoostMap>();
|
||||||
|
::boost::movelib::unique_ptr<MyStdMap> const pstdmap = ::boost::movelib::make_unique<MyStdMap>();
|
||||||
|
::boost::movelib::unique_ptr<MyBoostMultiMap> const pboostmultimap = ::boost::movelib::make_unique<MyBoostMultiMap>();
|
||||||
|
::boost::movelib::unique_ptr<MyStdMultiMap> const pstdmultimap = ::boost::movelib::make_unique<MyStdMultiMap>();
|
||||||
|
MyBoostMap &boostmap = *pboostmap;
|
||||||
|
MyStdMap &stdmap = *pstdmap;
|
||||||
|
MyBoostMultiMap &boostmultimap = *pboostmultimap;
|
||||||
|
MyStdMultiMap &stdmultimap = *pstdmultimap;
|
||||||
|
|
||||||
|
if (map_test_step(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_insert(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_erase(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_insert2(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_search(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_indexing(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_insert_or_assign(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_try_emplace(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (map_test_merge(boostmap, stdmap, boostmultimap, stdmultimap))
|
||||||
|
return 1;
|
||||||
|
|
||||||
if(map_test_copyable<MyBoostMap, MyStdMap, MyBoostMultiMap, MyStdMultiMap>
|
if(map_test_copyable<MyBoostMap, MyStdMap, MyBoostMultiMap, MyStdMultiMap>
|
||||||
(dtl::bool_<boost::container::test::is_copyable<IntType>::value>())){
|
(dtl::bool_<boost::container::test::is_copyable<IntType>::value>())){
|
||||||
|
Reference in New Issue
Block a user