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 | // <list> |
10 | |
11 | // void pop_front(); |
12 | |
13 | #include <list> |
14 | #include <cassert> |
15 | |
16 | #include "test_macros.h" |
17 | #include "min_allocator.h" |
18 | |
19 | int main(int, char**) { |
20 | { |
21 | int a[] = {1, 2, 3}; |
22 | std::list<int> c(a, a + 3); |
23 | c.pop_front(); |
24 | assert(c == std::list<int>(a + 1, a + 3)); |
25 | c.pop_front(); |
26 | assert(c == std::list<int>(a + 2, a + 3)); |
27 | c.pop_front(); |
28 | assert(c.empty()); |
29 | } |
30 | #if TEST_STD_VER >= 11 |
31 | { |
32 | int a[] = {1, 2, 3}; |
33 | std::list<int, min_allocator<int>> c(a, a + 3); |
34 | c.pop_front(); |
35 | assert((c == std::list<int, min_allocator<int>>(a + 1, a + 3))); |
36 | c.pop_front(); |
37 | assert((c == std::list<int, min_allocator<int>>(a + 2, a + 3))); |
38 | c.pop_front(); |
39 | assert(c.empty()); |
40 | } |
41 | #endif |
42 | |
43 | return 0; |
44 | } |
45 | |