Simplify tests to support old gcc 4.2 compilers

This commit is contained in:
Ion Gaztañaga
2016-06-25 11:05:40 +02:00
parent 2a04243de7
commit e707b671fd
2 changed files with 15 additions and 9 deletions

View File

@@ -97,10 +97,12 @@ bool CheckEqualPairContainers(const MyBoostCont &boostcont, const MyStdCont &std
typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end());
typename MyStdCont::const_iterator itstd(stdcont.begin());
for(; itboost != itboostend; ++itboost, ++itstd){
if(itboost->first != key_type(itstd->first))
key_type k(itstd->first);
if(itboost->first != k)
return false;
if(itboost->second != mapped_type(itstd->second))
mapped_type m(itstd->second);
if(itboost->second != m)
return false;
}
return true;

View File

@@ -429,9 +429,10 @@ int map_test()
if(!CheckEqualPairContainers(boostmultimap, stdmultimap)) return 1;
for(int i = 0, j = static_cast<int>(boostmap.size()); i < j; ++i){
boostmap.erase(IntType(i));
IntType k(i);
boostmap.erase(k);
stdmap.erase(i);
boostmultimap.erase(IntType(i));
boostmultimap.erase(k);
stdmultimap.erase(i);
}
if(!CheckEqualPairContainers(boostmap, stdmap)) return 1;
@@ -559,7 +560,8 @@ int map_test()
IntType i2(i);
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
}
boostmap.insert(boostmap.lower_bound(IntType(i)), boost::move(intpair));
IntType k(i);
boostmap.insert(boostmap.lower_bound(k), boost::move(intpair));
stdmap.insert(stdmap.lower_bound(i), StdPairType(i, i));
//PrintContainers(boostmap, stdmap);
{
@@ -628,11 +630,12 @@ int map_test()
//Compare count with std containers
for(int i = 0; i < max; ++i){
if(boostmap.count(IntType(i)) != stdmap.count(i)){
IntType k(i);
if(boostmap.count(k) != stdmap.count(i)){
return -1;
}
if(boostmultimap.count(IntType(i)) != stdmultimap.count(i)){
if(boostmultimap.count(k) != stdmultimap.count(i)){
return -1;
}
}
@@ -656,9 +659,10 @@ int map_test()
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
}
boostmultimap.insert(boost::move(intpair));
if(boostmap.count(IntType(i)) != typename MyBoostMultiMap::size_type(1))
IntType k(i);
if(boostmap.count(k) != typename MyBoostMultiMap::size_type(1))
return 1;
if(boostmultimap.count(IntType(i)) != typename MyBoostMultiMap::size_type(j+1))
if(boostmultimap.count(k) != typename MyBoostMultiMap::size_type(j+1))
return 1;
}
}