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 n, const value_type& v);
20 #include "test_macros.h"
21 #include "min_allocator.h"
25 make(int size, int start = 0 )
27 const int b = 4096 / sizeof(int);
31 init = (start+1) / b + ((start+1) % b != 0);
36 for (int i = 0; i < init-start; ++i)
38 for (int i = 0; i < size; ++i)
40 for (int i = 0; i < start; ++i)
47 test(C& c1, int size, int x)
49 typedef typename C::const_iterator CI;
50 typename C::size_type c1_osize = c1.size();
52 assert(c1.size() == static_cast<std::size_t>(size));
53 assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
55 for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
57 for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
63 testN(int start, int N, int M)
65 C c1 = make<C>(N, start);
72 int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
73 const int N = sizeof(rng)/sizeof(rng[0]);
74 for (int i = 0; i < N; ++i)
75 for (int j = 0; j < N; ++j)
76 for (int k = 0; k < N; ++k)
77 testN<std::deque<int> >(rng[i], rng[j], rng[k]);
79 #if TEST_STD_VER >= 11
81 int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
82 const int N = sizeof(rng)/sizeof(rng[0]);
83 for (int i = 0; i < N; ++i)
84 for (int j = 0; j < N; ++j)
85 for (int k = 0; k < N; ++k)
86 testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);