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 push_front(value_type&& v);
19 #include "min_allocator.h"
21 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
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)
39 c.push_back(MoveOnly(i));
40 for (int i = 0; i < start; ++i)
49 typedef typename C::iterator I;
50 std::size_t c1_osize = c1.size();
51 c1.push_front(MoveOnly(x));
52 assert(c1.size() == c1_osize + 1);
53 assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
55 assert(*i == MoveOnly(x));
57 for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
58 assert(*i == MoveOnly(j));
63 testN(int start, int N)
65 C c1 = make<C>(N, start);
69 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
73 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
75 int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
76 const int N = sizeof(rng)/sizeof(rng[0]);
77 for (int i = 0; i < N; ++i)
78 for (int j = 0; j < N; ++j)
79 testN<std::deque<MoveOnly> >(rng[i], rng[j]);
81 #if TEST_STD_VER >= 11
83 int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
84 const int N = sizeof(rng)/sizeof(rng[0]);
85 for (int i = 0; i < N; ++i)
86 for (int j = 0; j < N; ++j)
87 testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
90 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES