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:
Vadim Zeitlin 2017-11-21 14:44:06 +01:00
parent 4ccda3959e
commit f7d9098f1f

View File

@ -369,13 +369,17 @@ TEST_CASE("wxVector::capacity", "[vector][capacity][shrink_to_fit]")
v.push_back(0);
// 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
// own one we can, allowing us to check that shrink_to_fit() really shrinks
// the capacity below.
// strategy it uses, so we can't rely on the stricter check passing, but
// with our own one we can, allowing us to check that shrink_to_fit()
// really shrinks the capacity below.
#if !wxUSE_STD_CONTAINERS
CHECK( v.capacity() > 1 );
#else
CHECK( v.capacity() >= 1 );
#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();
CHECK( v.capacity() == 1 );
@ -384,4 +388,5 @@ TEST_CASE("wxVector::capacity", "[vector][capacity][shrink_to_fit]")
v.shrink_to_fit();
CHECK( v.capacity() == 0 );
#endif
}