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 #include "asan_testing.h"
18 #include "test_macros.h"
19 #include "min_allocator.h"
23 make(int size
, int start
= 0 )
25 const int b
= 4096 / sizeof(int);
29 init
= (start
+1) / b
+ ((start
+1) % b
!= 0);
34 for (int i
= 0; i
< init
-start
; ++i
)
36 for (int i
= 0; i
< size
; ++i
)
38 for (int i
= 0; i
< start
; ++i
)
47 typedef typename
C::iterator I
;
48 std::size_t c1_osize
= c1
.size();
50 assert(c1
.size() == c1_osize
- 1);
51 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
52 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1
));
54 for (int j
= 0; static_cast<std::size_t>(j
) < c1
.size(); ++j
, ++i
)
60 testN(int start
, int N
)
64 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 testN
<std::deque
<int> >(rng
[i
], rng
[j
]);
78 #if TEST_STD_VER >= 11
80 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
81 const int N
= sizeof(rng
)/sizeof(rng
[0]);
82 for (int i
= 0; i
< N
; ++i
)
83 for (int j
= 0; j
< N
; ++j
)
84 testN
<std::deque
<int, min_allocator
<int>> >(rng
[i
], rng
[j
]);
87 int rng
[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
88 const int N
= sizeof(rng
)/sizeof(rng
[0]);
89 for (int i
= 0; i
< N
; ++i
)
90 for (int j
= 0; j
< N
; ++j
)
91 testN
<std::deque
<int, safe_allocator
<int>> >(rng
[i
], rng
[j
]);