1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // void resize(size_type sz, const value_type& x);
16 #include "../../../stack_allocator.h"
17 #include "min_allocator.h"
18 #include "asan_testing.h"
23 std::vector<int> v(100);
25 assert(v.size() == 50);
26 assert(v.capacity() == 100);
27 assert(v == std::vector<int>(50));
29 assert(v.size() == 200);
30 assert(v.capacity() >= 200);
31 assert(is_contiguous_container_asan_correct(v));
32 for (unsigned i = 0; i < 50; ++i)
34 for (unsigned i = 50; i < 200; ++i)
38 std::vector<int, stack_allocator<int, 300> > v(100);
40 assert(v.size() == 50);
41 assert(v.capacity() == 100);
43 assert(v.size() == 200);
44 assert(v.capacity() >= 200);
45 assert(is_contiguous_container_asan_correct(v));
47 #if __cplusplus >= 201103L
49 std::vector<int, min_allocator<int>> v(100);
51 assert(v.size() == 50);
52 assert(v.capacity() == 100);
53 assert(is_contiguous_container_asan_correct(v));
54 assert((v == std::vector<int, min_allocator<int>>(50)));
56 assert(v.size() == 200);
57 assert(v.capacity() >= 200);
58 assert(is_contiguous_container_asan_correct(v));
59 for (unsigned i = 0; i < 50; ++i)
61 for (unsigned i = 50; i < 200; ++i)
65 std::vector<int, min_allocator<int>> v(100);
67 assert(v.size() == 50);
68 assert(v.capacity() == 100);
69 assert(is_contiguous_container_asan_correct(v));
71 assert(v.size() == 200);
72 assert(v.capacity() >= 200);
73 assert(is_contiguous_container_asan_correct(v));