Debian Codegraph @

libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp

raw
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 {
25 typedef std::deque<int> C;
26 C c;
27 ASSERT_NOEXCEPT(c.empty());
28 assert(c.empty());
29 c.push_back(C::value_type(1));
30 assert(!c.empty());
31 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
32 c.clear();
33 assert(c.empty());
34 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
35 }
36 #if TEST_STD_VER >= 11
37 {
38 typedef std::deque<int, min_allocator<int>> C;
39 C c;
40 ASSERT_NOEXCEPT(c.empty());
41 assert(c.empty());
42 c.push_back(C::value_type(1));
43 assert(!c.empty());
44 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
45 c.clear();
46 assert(c.empty());
47 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
48 }
49 #endif
50
51 return 0;
52 }