[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / list / list.ops / unique.pass.cpp
blob85c4ec587c1ec5d6492bf9efc16b53aed106b457
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 // <list>
11 // void unique(); // before C++20
12 // size_type unique(); // C++20 and later
14 #include <list>
15 #include <cassert>
17 #include "test_macros.h"
18 #include "min_allocator.h"
20 int main(int, char**)
23 int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
24 int a2[] = {2, 1, 4, 3};
25 typedef std::list<int> L;
26 L c(a1, a1+sizeof(a1)/sizeof(a1[0]));
27 #if TEST_STD_VER > 17
28 ASSERT_SAME_TYPE(L::size_type, decltype(c.unique()));
29 assert(c.unique() == 5);
30 #else
31 ASSERT_SAME_TYPE(void, decltype(c.unique()));
32 c.unique();
33 #endif
34 assert(c == std::list<int>(a2, a2+4));
36 #if TEST_STD_VER >= 11
38 int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
39 int a2[] = {2, 1, 4, 3};
40 std::list<int, min_allocator<int>> c(a1, a1+sizeof(a1)/sizeof(a1[0]));
41 #if TEST_STD_VER > 17
42 assert(c.unique() == 5);
43 #else
44 c.unique();
45 #endif
46 assert((c == std::list<int, min_allocator<int>>(a2, a2+4)));
48 #endif
50 return 0;