[nfc][mlir][scf]: Define scf.for lower/upper bounds can be also negative or zero...
[llvm-project.git] / libcxx / test / std / containers / sequences / deque / deque.modifiers / clear.pass.cpp
blob1e0b04dd24f2511507109b616f94235480d49152
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 //===----------------------------------------------------------------------===//
9 // <deque>
11 // void clear() noexcept;
13 #include "asan_testing.h"
14 #include <deque>
15 #include <cassert>
17 #include "test_macros.h"
18 #include "../../../NotConstructible.h"
19 #include "min_allocator.h"
21 int main(int, char**)
24 typedef NotConstructible T;
25 typedef std::deque<T> C;
26 C c;
27 ASSERT_NOEXCEPT(c.clear());
28 c.clear();
29 assert(std::distance(c.begin(), c.end()) == 0);
30 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
33 typedef int T;
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());
39 c.clear();
40 assert(std::distance(c.begin(), c.end()) == 0);
41 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
43 c.clear();
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;
51 C c;
52 ASSERT_NOEXCEPT(c.clear());
53 c.clear();
54 assert(std::distance(c.begin(), c.end()) == 0);
55 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
58 typedef int T;
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());
64 c.clear();
65 assert(std::distance(c.begin(), c.end()) == 0);
66 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
68 c.clear();
69 assert(std::distance(c.begin(), c.end()) == 0);
70 LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
72 #endif
74 return 0;