From f7d9098f1f091ffb53e3d6cb60ee9ea664936f29 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 21 Nov 2017 14:44:06 +0100 Subject: [PATCH] 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. --- tests/vectors/vectors.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/vectors/vectors.cpp b/tests/vectors/vectors.cpp index 8495cdca58..25a9a5cdd5 100644 --- a/tests/vectors/vectors.cpp +++ b/tests/vectors/vectors.cpp @@ -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 }