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);
17 #include "asan_testing.h"
21 #include "test_macros.h"
23 #include "min_allocator.h"
28 make(int size
, int start
= 0 )
30 const int b
= 4096 / sizeof(int);
34 init
= (start
+1) / b
+ ((start
+1) % b
!= 0);
39 for (int i
= 0; i
< init
-start
; ++i
)
41 for (int i
= 0; i
< size
; ++i
)
42 c
.push_back(MoveOnly(i
));
43 for (int i
= 0; i
< start
; ++i
)
51 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
52 const int N
= sizeof(rng
)/sizeof(rng
[0]);
53 for (int j
= 0; j
< N
; ++j
)
55 C c
= make
<C
>(size
, rng
[j
]);
56 typename
C::const_iterator it
= c
.begin();
57 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
58 for (int i
= 0; i
< size
; ++i
, (void) ++it
)
59 assert(*it
== MoveOnly(i
));
67 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
68 const int N
= sizeof(rng
)/sizeof(rng
[0]);
69 for (int j
= 0; j
< N
; ++j
)
70 test
<std::deque
<MoveOnly
> >(rng
[j
]);
73 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
74 const int N
= sizeof(rng
)/sizeof(rng
[0]);
75 for (int j
= 0; j
< N
; ++j
)
76 test
<std::deque
<MoveOnly
, min_allocator
<MoveOnly
>> >(rng
[j
]);
79 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
80 const int N
= sizeof(rng
)/sizeof(rng
[0]);
81 for (int j
= 0; j
< N
; ++j
)
82 test
<std::deque
<MoveOnly
, safe_allocator
<MoveOnly
>> >(rng
[j
]);