STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
Improve portability of vector tests. This test was assuming libcxx's 2x growth factor, which isn't guaranteed by the Standard and isn't provided by MSVC (we use 1.5x). As a result the exact capacity check fails. Marking the assertion as libcxx-specific is all we need, and allows the rest of the test to succeed. http://reviews.llvm.org/D21348 Files: test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp Index: test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp =================================================================== --- test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -43,7 +43,7 @@ v.push_back(1); assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); - assert(v.capacity() == 200); + LIBCPP_ASSERT(v.capacity() == 200); // assumes libc++'s 2x growth factor assert(v.size() == 101); assert(is_contiguous_container_asan_correct(v)); }
Index: test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp =================================================================== --- test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -43,7 +43,7 @@ v.push_back(1); assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); - assert(v.capacity() == 200); + LIBCPP_ASSERT(v.capacity() == 200); // assumes libc++'s 2x growth factor assert(v.size() == 101); assert(is_contiguous_container_asan_correct(v)); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits