[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / associative / set / set.cons / move.pass.cpp
blob7fa0f8da4d623dc89ac78a0fc5fdc11042700883
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 // UNSUPPORTED: c++03
11 // <set>
13 // class set
15 // set(set&& s);
17 #include <set>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "../../../test_compare.h"
22 #include "test_allocator.h"
23 #include "min_allocator.h"
25 int main(int, char**)
28 typedef int V;
29 typedef test_less<int> C;
30 typedef test_allocator<V> A;
31 std::set<int, C, A> mo(C(5), A(7));
32 std::set<int, C, A> m = std::move(mo);
33 assert(m.get_allocator() == A(7));
34 assert(m.key_comp() == C(5));
35 assert(m.size() == 0);
36 assert(std::distance(m.begin(), m.end()) == 0);
38 assert(mo.get_allocator() == A(test_alloc_base::moved_value));
39 assert(mo.key_comp() == C(5));
40 assert(mo.size() == 0);
41 assert(std::distance(mo.begin(), mo.end()) == 0);
44 typedef int V;
45 V ar[] =
57 typedef test_less<int> C;
58 typedef test_allocator<V> A;
59 std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
60 std::set<int, C, A> m = std::move(mo);
61 assert(m.get_allocator() == A(7));
62 assert(m.key_comp() == C(5));
63 assert(m.size() == 3);
64 assert(std::distance(m.begin(), m.end()) == 3);
65 assert(*m.begin() == 1);
66 assert(*std::next(m.begin()) == 2);
67 assert(*std::next(m.begin(), 2) == 3);
69 assert(mo.get_allocator() == A(test_alloc_base::moved_value));
70 assert(mo.key_comp() == C(5));
71 assert(mo.size() == 0);
72 assert(std::distance(mo.begin(), mo.end()) == 0);
75 typedef int V;
76 V ar[] =
88 typedef test_less<int> C;
89 typedef min_allocator<V> A;
90 std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
91 std::set<int, C, A> m = std::move(mo);
92 assert(m.get_allocator() == A());
93 assert(m.key_comp() == C(5));
94 assert(m.size() == 3);
95 assert(std::distance(m.begin(), m.end()) == 3);
96 assert(*m.begin() == 1);
97 assert(*std::next(m.begin()) == 2);
98 assert(*std::next(m.begin(), 2) == 3);
100 assert(mo.get_allocator() == A());
101 assert(mo.key_comp() == C(5));
102 assert(mo.size() == 0);
103 assert(std::distance(mo.begin(), mo.end()) == 0);
106 return 0;