[PATCH] D21348: [libcxx] [test] Improve portability of vector tests.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 14 14:20:35 PDT 2016
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));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21348.60752.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160614/899db85b/attachment.bin>
More information about the cfe-commits
mailing list