1 | //===----------------------------------------------------------------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <deque> |
10 | |
11 | // deque() |
12 | |
13 | #include "asan_testing.h" |
14 | #include <deque> |
15 | #include <cassert> |
16 | |
17 | #include "test_macros.h" |
18 | #include "test_allocator.h" |
19 | #include "../../../NotConstructible.h" |
20 | #include "min_allocator.h" |
21 | |
22 | template <class T, class Allocator> |
23 | void |
24 | test() |
25 | { |
26 | std::deque<T, Allocator> d; |
27 | assert(d.size() == 0); |
28 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); |
29 | #if TEST_STD_VER >= 11 |
30 | std::deque<T, Allocator> d1 = {}; |
31 | assert(d1.size() == 0); |
32 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d1)); |
33 | #endif |
34 | } |
35 | |
36 | int main(int, char**) |
37 | { |
38 | test<int, std::allocator<int> >(); |
39 | test<NotConstructible, limited_allocator<NotConstructible, 1> >(); |
40 | #if TEST_STD_VER >= 11 |
41 | test<int, min_allocator<int> >(); |
42 | test<NotConstructible, min_allocator<NotConstructible> >(); |
43 | #endif |
44 | |
45 | return 0; |
46 | } |
47 | |