]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / libcxx / containers / sequences / list / list.modifiers / pop_back_db1.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // Can't test the system lib because this test enables debug mode
11 // UNSUPPORTED: with_system_cxx_lib
12
13 // <list>
14
15 // void pop_back();
16
17 #define _LIBCPP_DEBUG 1
18 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
19
20 #include <list>
21 #include <cstdlib>
22 #include <cassert>
23
24 int main()
25 {
26     int a[] = {1, 2, 3};
27     std::list<int> c(a, a+3);
28     c.pop_back();
29     assert(c == std::list<int>(a, a+2));
30     c.pop_back();
31     assert(c == std::list<int>(a, a+1));
32     c.pop_back();
33     assert(c.empty());
34     c.pop_back(); // operation under test
35     assert(false);
36 }