1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // void push_back(value_type&& v);
20 #include "test_macros.h"
22 #include "min_allocator.h"
27 make(int size
, int start
= 0 )
29 const int b
= 4096 / sizeof(int);
33 init
= (start
+1) / b
+ ((start
+1) % b
!= 0);
38 for (int i
= 0; i
< init
-start
; ++i
)
40 for (int i
= 0; i
< size
; ++i
)
41 c
.push_back(MoveOnly(i
));
42 for (int i
= 0; i
< start
; ++i
)
50 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
51 const int N
= sizeof(rng
)/sizeof(rng
[0]);
52 for (int j
= 0; j
< N
; ++j
)
54 C c
= make
<C
>(size
, rng
[j
]);
55 typename
C::const_iterator it
= c
.begin();
56 for (int i
= 0; i
< size
; ++i
, ++it
)
57 assert(*it
== MoveOnly(i
));
65 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
66 const int N
= sizeof(rng
)/sizeof(rng
[0]);
67 for (int j
= 0; j
< N
; ++j
)
68 test
<std::deque
<MoveOnly
> >(rng
[j
]);
71 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
72 const int N
= sizeof(rng
)/sizeof(rng
[0]);
73 for (int j
= 0; j
< N
; ++j
)
74 test
<std::deque
<MoveOnly
, min_allocator
<MoveOnly
>> >(rng
[j
]);