diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2015-03-30 23:26:16 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2015-03-30 23:26:16 +0000 |
| commit | 4c302598798c99a2b9e4591cf1b3db2925f047ed (patch) | |
| tree | bc820224cdc75f1123efb8760a74cc02d3380dd8 /libcxx/test/std/containers/sequences/vector/vector.cons | |
| parent | 33af7a8f50d6de317aa86849d7593c4cc31bb23e (diff) | |
| download | bcm5719-llvm-4c302598798c99a2b9e4591cf1b3db2925f047ed.tar.gz bcm5719-llvm-4c302598798c99a2b9e4591cf1b3db2925f047ed.zip | |
Make the new tests better; make sure that we're testing the case where no reallocation has to happen
llvm-svn: 233641
Diffstat (limited to 'libcxx/test/std/containers/sequences/vector/vector.cons')
| -rw-r--r-- | libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp | 6 | ||||
| -rw-r--r-- | libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp index dd9a1e61545..c40583b297e 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp @@ -35,7 +35,8 @@ int main() { typedef std::vector<int> V; V d1; - V d2(10); // no reallocation during assign. + V d2; + d2.reserve(10); // no reallocation during assign. test(d1); test(d2); } @@ -44,7 +45,8 @@ int main() { typedef std::vector<int, min_allocator<int>> V; V d1; - V d2(10); // no reallocation during assign. + V d2; + d2.reserve(10); // no reallocation during assign. test(d1); test(d2); } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp index 9ec833e4974..51b16ecd0ba 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp @@ -14,6 +14,7 @@ #include <vector> #include <algorithm> #include <cassert> +#include <iostream> #include "min_allocator.h" #include "asan_testing.h" @@ -23,7 +24,9 @@ bool is6(int x) { return x == 6; } template <typename Vec> void test ( Vec &v ) { + std::cout << "Size, cap: " << v.size() << " " << v.capacity() << std::endl; v.assign(5, 6); + std::cout << "Size, cap: " << v.size() << " " << v.capacity() << std::endl; assert(v.size() == 5); assert(is_contiguous_container_asan_correct(v)); assert(std::all_of(v.begin(), v.end(), is6)); @@ -34,7 +37,8 @@ int main() { typedef std::vector<int> V; V d1; - V d2(10); // no reallocation during assign. + V d2; + d2.reserve(10); // no reallocation during assign. test(d1); test(d2); } @@ -43,7 +47,8 @@ int main() { typedef std::vector<int, min_allocator<int>> V; V d1; - V d2(10); // no reallocation during assign. + V d2; + d2.reserve(10); // no reallocation during assign. test(d1); test(d2); } |

