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 // size_type size() const noexcept;
15 #include "asan_testing.h"
19 #include "test_macros.h"
20 #include "min_allocator.h"
25 typedef std::deque
<int> C
;
27 ASSERT_NOEXCEPT(c
.size());
28 assert(c
.size() == 0);
29 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
30 c
.push_back(C::value_type(2));
31 assert(c
.size() == 1);
32 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
33 c
.push_back(C::value_type(1));
34 assert(c
.size() == 2);
35 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
36 c
.push_back(C::value_type(3));
37 assert(c
.size() == 3);
38 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
40 assert(c
.size() == 2);
41 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
43 assert(c
.size() == 1);
44 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
46 assert(c
.size() == 0);
47 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
49 #if TEST_STD_VER >= 11
51 typedef std::deque
<int, min_allocator
<int>> C
;
53 ASSERT_NOEXCEPT(c
.size());
54 assert(c
.size() == 0);
55 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
56 c
.push_back(C::value_type(2));
57 assert(c
.size() == 1);
58 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
59 c
.push_back(C::value_type(1));
60 assert(c
.size() == 2);
61 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
62 c
.push_back(C::value_type(3));
63 assert(c
.size() == 3);
64 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
66 assert(c
.size() == 2);
67 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
69 assert(c
.size() == 1);
70 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
72 assert(c
.size() == 0);
73 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));