[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.capacity / swap.pass.cpp
blob33df254c116966bcb1f1ecde803ca5c6936de97d
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 // <vector>
11 // void swap(vector& x);
13 #include <vector>
14 #include <cassert>
16 #include "test_macros.h"
17 #include "min_allocator.h"
18 #include "asan_testing.h"
20 int main(int, char**)
23 std::vector<int> v1(100);
24 std::vector<int> v2(200);
25 assert(is_contiguous_container_asan_correct(v1));
26 assert(is_contiguous_container_asan_correct(v2));
27 v1.swap(v2);
28 assert(v1.size() == 200);
29 assert(v1.capacity() == 200);
30 assert(is_contiguous_container_asan_correct(v1));
31 assert(v2.size() == 100);
32 assert(v2.capacity() == 100);
33 assert(is_contiguous_container_asan_correct(v2));
35 #if TEST_STD_VER >= 11
37 std::vector<int, min_allocator<int>> v1(100);
38 std::vector<int, min_allocator<int>> v2(200);
39 assert(is_contiguous_container_asan_correct(v1));
40 assert(is_contiguous_container_asan_correct(v2));
41 v1.swap(v2);
42 assert(v1.size() == 200);
43 assert(v1.capacity() == 200);
44 assert(is_contiguous_container_asan_correct(v1));
45 assert(v2.size() == 100);
46 assert(v2.capacity() == 100);
47 assert(is_contiguous_container_asan_correct(v2));
49 #endif
51 return 0;