| 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 | // class deque |
| 12 | |
| 13 | // bool empty() const noexcept; |
| 14 | |
| 15 | #include "asan_testing.h" |
| 16 | #include <deque> |
| 17 | #include <cassert> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | #include "min_allocator.h" |
| 21 | |
| 22 | int main(int, char**) { |
| 23 | { |
| 24 | typedef std::deque<int> C; |
| 25 | C c; |
| 26 | ASSERT_NOEXCEPT(c.empty()); |
| 27 | assert(c.empty()); |
| 28 | c.push_back(x: C::value_type(1)); |
| 29 | assert(!c.empty()); |
| 30 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); |
| 31 | c.clear(); |
| 32 | assert(c.empty()); |
| 33 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); |
| 34 | } |
| 35 | #if TEST_STD_VER >= 11 |
| 36 | { |
| 37 | typedef std::deque<int, min_allocator<int>> C; |
| 38 | C c; |
| 39 | ASSERT_NOEXCEPT(c.empty()); |
| 40 | assert(c.empty()); |
| 41 | c.push_back(C::value_type(1)); |
| 42 | assert(!c.empty()); |
| 43 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); |
| 44 | c.clear(); |
| 45 | assert(c.empty()); |
| 46 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); |
| 47 | } |
| 48 | #endif |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |