Refactor initializer_list tests to avoid code duplication and add some missing initializer_list overload tests

This commit is contained in:
Ion Gaztañaga
2015-02-27 19:24:46 +01:00
parent 90b3af4229
commit 7239c8e262
9 changed files with 132 additions and 105 deletions

View File

@@ -322,36 +322,7 @@ int test_set_variants()
return 0;
}
template<typename SetType>
bool test_support_for_initialization_list_for()
{
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
std::initializer_list<int> il = {1, 2, 3, 4, 5};
SetType expected(il.begin(), il.end());
{
SetType sil = il;
if (sil != expected)
return false;
SetType sil_ordered(ordered_unique_range, il);
if(sil_ordered != expected)
return false;
SetType sil_assign = {99, 100, 101, 102, 103, 104, 105};
sil_assign = il;
if(sil_assign != expected)
return false;
}
{
SetType sil;
sil.insert(il);
if(sil != expected)
return false;
}
return true;
#endif
return true;
}
int main ()
{
//Recursive container instantiation
@@ -431,10 +402,10 @@ int main ()
if(!boost::container::test::test_propagate_allocator<boost_container_multiset>())
return 1;
if(!test_support_for_initialization_list_for<set<int> >())
if (!boost::container::test::test_set_methods_with_initializer_list_as_argument_for<set<int> >())
return 1;
if(!test_support_for_initialization_list_for<multiset<int> >())
if (!boost::container::test::test_set_methods_with_initializer_list_as_argument_for<multiset<int> >())
return 1;
////////////////////////////////////