| 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 test() { |
| 24 | std::deque<T, Allocator> d; |
| 25 | assert(d.size() == 0); |
| 26 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); |
| 27 | #if TEST_STD_VER >= 11 |
| 28 | std::deque<T, Allocator> d1 = {}; |
| 29 | assert(d1.size() == 0); |
| 30 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d1)); |
| 31 | #endif |
| 32 | } |
| 33 | |
| 34 | int main(int, char**) { |
| 35 | test<int, std::allocator<int> >(); |
| 36 | test<NotConstructible, limited_allocator<NotConstructible, 1> >(); |
| 37 | #if TEST_STD_VER >= 11 |
| 38 | test<int, min_allocator<int> >(); |
| 39 | test<NotConstructible, min_allocator<NotConstructible> >(); |
| 40 | #endif |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |