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 //===----------------------------------------------------------------------===//
11 // void clear() noexcept;
13 #include "asan_testing.h"
17 #include "test_macros.h"
18 #include "../../../NotConstructible.h"
19 #include "min_allocator.h"
24 typedef NotConstructible T
;
25 typedef std::deque
<T
> C
;
27 ASSERT_NOEXCEPT(c
.clear());
29 assert(std::distance(c
.begin(), c
.end()) == 0);
30 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
34 typedef std::deque
<T
> C
;
35 const T t
[] = {0, 1, 2, 3, 4};
36 C
c(std::begin(t
), std::end(t
));
38 ASSERT_NOEXCEPT(c
.clear());
40 assert(std::distance(c
.begin(), c
.end()) == 0);
41 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
44 assert(std::distance(c
.begin(), c
.end()) == 0);
45 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
47 #if TEST_STD_VER >= 11
49 typedef NotConstructible T
;
50 typedef std::deque
<T
, min_allocator
<T
>> C
;
52 ASSERT_NOEXCEPT(c
.clear());
54 assert(std::distance(c
.begin(), c
.end()) == 0);
55 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
59 typedef std::deque
<T
, min_allocator
<T
>> C
;
60 const T t
[] = {0, 1, 2, 3, 4};
61 C
c(std::begin(t
), std::end(t
));
63 ASSERT_NOEXCEPT(c
.clear());
65 assert(std::distance(c
.begin(), c
.end()) == 0);
66 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));
69 assert(std::distance(c
.begin(), c
.end()) == 0);
70 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c
));