Fix building wxVector unit tests in STL build without C++11
There is no shrink_to_fit() in wxVector in this case. Arguably, we shouldn't be building wxVector unit tests in STL build at all as there is no point in testing the standard class, but OTOH it could be useful for checking that the tests themselves are correct, so keep them for now.
This commit is contained in:
@@ -369,13 +369,17 @@ TEST_CASE("wxVector::capacity", "[vector][capacity][shrink_to_fit]")
|
|||||||
|
|
||||||
v.push_back(0);
|
v.push_back(0);
|
||||||
// When using the standard library vector, we don't know what growth
|
// When using the standard library vector, we don't know what growth
|
||||||
// strategy it uses, so we can't rely on this check passing, but with our
|
// strategy it uses, so we can't rely on the stricter check passing, but
|
||||||
// own one we can, allowing us to check that shrink_to_fit() really shrinks
|
// with our own one we can, allowing us to check that shrink_to_fit()
|
||||||
// the capacity below.
|
// really shrinks the capacity below.
|
||||||
#if !wxUSE_STD_CONTAINERS
|
#if !wxUSE_STD_CONTAINERS
|
||||||
CHECK( v.capacity() > 1 );
|
CHECK( v.capacity() > 1 );
|
||||||
|
#else
|
||||||
|
CHECK( v.capacity() >= 1 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// There is no shrink_to_fit() in STL build when not using C++11.
|
||||||
|
#if !wxUSE_STD_CONTAINERS || __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10)
|
||||||
v.shrink_to_fit();
|
v.shrink_to_fit();
|
||||||
CHECK( v.capacity() == 1 );
|
CHECK( v.capacity() == 1 );
|
||||||
|
|
||||||
@@ -384,4 +388,5 @@ TEST_CASE("wxVector::capacity", "[vector][capacity][shrink_to_fit]")
|
|||||||
|
|
||||||
v.shrink_to_fit();
|
v.shrink_to_fit();
|
||||||
CHECK( v.capacity() == 0 );
|
CHECK( v.capacity() == 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user