mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 14:34:27 +02:00
Test more constructors
This commit is contained in:
@@ -53,7 +53,8 @@ bool test_range_insertion()
|
|||||||
for (std::size_t i = 0; i <= input_deque.size(); ++i)
|
for (std::size_t i = 0; i <= input_deque.size(); ++i)
|
||||||
{
|
{
|
||||||
std::deque<int> std_deque;
|
std::deque<int> std_deque;
|
||||||
SeqContainer seq_container;
|
::boost::movelib::unique_ptr<SeqContainer> const pseqcontainer = ::boost::movelib::make_unique<SeqContainer>();
|
||||||
|
SeqContainer &seq_container = *pseqcontainer;
|
||||||
|
|
||||||
for (int element = -10; element < 10; ++element)
|
for (int element = -10; element < 10; ++element)
|
||||||
{
|
{
|
||||||
|
@@ -70,6 +70,32 @@ bool list_copyable_only(V1 &boostlist, V2 &stdlist, boost::container::container_
|
|||||||
stdlist.push_front(int(3));
|
stdlist.push_front(int(3));
|
||||||
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
if(!test::CheckEqualContainers(boostlist, stdlist)) return false;
|
||||||
}
|
}
|
||||||
|
{ //List(const List &)
|
||||||
|
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostlist);
|
||||||
|
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdlist);
|
||||||
|
|
||||||
|
V1 &v1 = *pv1;
|
||||||
|
V2 &v2 = *pv2;
|
||||||
|
|
||||||
|
boostlist.clear();
|
||||||
|
stdlist.clear();
|
||||||
|
boostlist.assign(v1.begin(), v1.end());
|
||||||
|
stdlist.assign(v2.begin(), v2.end());
|
||||||
|
if(!test::CheckEqualContainers(boostlist, stdlist)) return 1;
|
||||||
|
}
|
||||||
|
{ //List(const List &, alloc)
|
||||||
|
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostlist, typename V1::allocator_type());
|
||||||
|
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdlist);
|
||||||
|
|
||||||
|
V1 &v1 = *pv1;
|
||||||
|
V2 &v2 = *pv2;
|
||||||
|
|
||||||
|
boostlist.clear();
|
||||||
|
stdlist.clear();
|
||||||
|
boostlist.assign(v1.begin(), v1.end());
|
||||||
|
stdlist.assign(v2.begin(), v2.end());
|
||||||
|
if(!test::CheckEqualContainers(boostlist, stdlist)) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -158,6 +184,26 @@ int list_test (bool copied_allocators_equal = true)
|
|||||||
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>(100);
|
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>(100);
|
||||||
if(!test::CheckEqualContainers(*pboostlist, *pstdlist)) return 1;
|
if(!test::CheckEqualContainers(*pboostlist, *pstdlist)) return 1;
|
||||||
}
|
}
|
||||||
|
{ //List(List &&)
|
||||||
|
::boost::movelib::unique_ptr<MyStdList> const stdlistp = ::boost::movelib::make_unique<MyStdList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp = ::boost::movelib::make_unique<MyBoostList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp2 = ::boost::movelib::make_unique<MyBoostList>(::boost::move(*boostlistp));
|
||||||
|
if(!test::CheckEqualContainers(*boostlistp2, *stdlistp)) return 1;
|
||||||
|
}
|
||||||
|
{ //List(List &&, alloc)
|
||||||
|
::boost::movelib::unique_ptr<MyStdList> const stdlistp = ::boost::movelib::make_unique<MyStdList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp = ::boost::movelib::make_unique<MyBoostList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp2 = ::boost::movelib::make_unique<MyBoostList>
|
||||||
|
(::boost::move(*boostlistp), typename MyBoostList::allocator_type());
|
||||||
|
if(!test::CheckEqualContainers(*boostlistp2, *stdlistp)) return 1;
|
||||||
|
}
|
||||||
|
{ //List operator=(List &&)
|
||||||
|
::boost::movelib::unique_ptr<MyStdList> const stdlistp = ::boost::movelib::make_unique<MyStdList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp = ::boost::movelib::make_unique<MyBoostList>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostList> const boostlistp2 = ::boost::movelib::make_unique<MyBoostList>();
|
||||||
|
*boostlistp2 = ::boost::move(*boostlistp);
|
||||||
|
if(!test::CheckEqualContainers(*boostlistp2, *stdlistp)) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
::boost::movelib::unique_ptr<MyBoostList> const pboostlist = ::boost::movelib::make_unique<MyBoostList>();
|
::boost::movelib::unique_ptr<MyBoostList> const pboostlist = ::boost::movelib::make_unique<MyBoostList>();
|
||||||
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>();
|
::boost::movelib::unique_ptr<MyStdList> const pstdlist = ::boost::movelib::make_unique<MyStdList>();
|
||||||
|
@@ -103,6 +103,20 @@ int set_test_copyable(boost::container::container_detail::true_type)
|
|||||||
if(!CheckEqualContainers(boostmsetcopy, stdmsetcopy))
|
if(!CheckEqualContainers(boostmsetcopy, stdmsetcopy))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
//Now, test copy constructor
|
||||||
|
MyBoostSet boostsetcopy(boostset, typename MyBoostSet::allocator_type());
|
||||||
|
MyStdSet stdsetcopy(stdset);
|
||||||
|
|
||||||
|
if(!CheckEqualContainers(boostsetcopy, stdsetcopy))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
MyBoostMultiSet boostmsetcopy(boostmultiset, typename MyBoostSet::allocator_type());
|
||||||
|
MyStdMultiSet stdmsetcopy(stdmultiset);
|
||||||
|
|
||||||
|
if(!CheckEqualContainers(boostmsetcopy, stdmsetcopy))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,7 +86,7 @@ bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::cont
|
|||||||
stdvector.push_back(int(3));
|
stdvector.push_back(int(3));
|
||||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
|
||||||
}
|
}
|
||||||
{
|
{ //Vector(const Vector &)
|
||||||
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostvector);
|
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostvector);
|
||||||
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdvector);
|
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdvector);
|
||||||
|
|
||||||
@@ -99,6 +99,19 @@ bool vector_copyable_only(V1 &boostvector, V2 &stdvector, boost::container::cont
|
|||||||
stdvector.assign(v2.begin(), v2.end());
|
stdvector.assign(v2.begin(), v2.end());
|
||||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||||
}
|
}
|
||||||
|
{ //Vector(const Vector &, alloc)
|
||||||
|
::boost::movelib::unique_ptr<V1> const pv1 = ::boost::movelib::make_unique<V1>(boostvector, typename V1::allocator_type());
|
||||||
|
::boost::movelib::unique_ptr<V2> const pv2 = ::boost::movelib::make_unique<V2>(stdvector);
|
||||||
|
|
||||||
|
V1 &v1 = *pv1;
|
||||||
|
V2 &v2 = *pv2;
|
||||||
|
|
||||||
|
boostvector.clear();
|
||||||
|
stdvector.clear();
|
||||||
|
boostvector.assign(v1.begin(), v1.end());
|
||||||
|
stdvector.assign(v2.begin(), v2.end());
|
||||||
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -123,7 +136,26 @@ int vector_test()
|
|||||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||||
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
if(!test::CheckEqualContainers(*boostvectorp, *stdvectorp)) return 1;
|
||||||
}
|
}
|
||||||
|
{ //Vector(Vector &&)
|
||||||
|
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>(::boost::move(*boostvectorp));
|
||||||
|
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||||
|
}
|
||||||
|
{ //Vector(Vector &&, alloc)
|
||||||
|
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>
|
||||||
|
(::boost::move(*boostvectorp), typename MyBoostVector::allocator_type());
|
||||||
|
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||||
|
}
|
||||||
|
{ //Vector operator=(Vector &&)
|
||||||
|
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>(100);
|
||||||
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp2 = ::boost::movelib::make_unique<MyBoostVector>();
|
||||||
|
*boostvectorp2 = ::boost::move(*boostvectorp);
|
||||||
|
if(!test::CheckEqualContainers(*boostvectorp2, *stdvectorp)) return 1;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>();
|
::boost::movelib::unique_ptr<MyBoostVector> const boostvectorp = ::boost::movelib::make_unique<MyBoostVector>();
|
||||||
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>();
|
::boost::movelib::unique_ptr<MyStdVector> const stdvectorp = ::boost::movelib::make_unique<MyStdVector>();
|
||||||
|
Reference in New Issue
Block a user