Skip to content

Commit 432ba35

Browse files
[libc++][test] Cover move construction of allocators again (#110375)
Previous PR #107344 fixed move constructor of `test_allocator` but dropped test coverage for move construction in some cases. This PR attempts to restore the test coverage. Thanks @Quuxplusone for reminding.
1 parent 78f9a8b commit 432ba35

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int main(int, char**)
3636
assert(std::distance(m.begin(), m.end()) == 0);
3737

3838
assert(mo.get_allocator() == A(7));
39+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
3940
assert(mo.key_comp() == C(5));
4041
assert(mo.size() == 0);
4142
assert(std::distance(mo.begin(), mo.end()) == 0);
@@ -66,6 +67,7 @@ int main(int, char**)
6667
assert(*std::next(m.begin(), 2) == V(3, 1));
6768

6869
assert(mo.get_allocator() == A(7));
70+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
6971
assert(mo.key_comp() == C(5));
7072
assert(mo.size() == 0);
7173
assert(std::distance(mo.begin(), mo.end()) == 0);

libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int main(int, char**)
3636
assert(std::distance(m.begin(), m.end()) == 0);
3737

3838
assert(mo.get_allocator() == A(7));
39+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
3940
assert(mo.key_comp() == C(5));
4041
assert(mo.size() == 0);
4142
assert(std::distance(mo.begin(), mo.end()) == 0);
@@ -72,6 +73,7 @@ int main(int, char**)
7273
assert(*std::next(m.begin(), 8) == V(3, 2));
7374

7475
assert(mo.get_allocator() == A(7));
76+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
7577
assert(mo.key_comp() == C(5));
7678
assert(mo.size() == 0);
7779
assert(std::distance(mo.begin(), mo.end()) == 0);

libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int main(int, char**)
3636
assert(std::distance(m.begin(), m.end()) == 0);
3737

3838
assert(mo.get_allocator() == A(7));
39+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
3940
assert(mo.key_comp() == C(5));
4041
assert(mo.size() == 0);
4142
assert(std::distance(mo.begin(), mo.end()) == 0);
@@ -73,6 +74,7 @@ int main(int, char**)
7374
assert(*std::next(m.begin(), 8) == 3);
7475

7576
assert(mo.get_allocator() == A(7));
77+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
7678
assert(mo.key_comp() == C(5));
7779
assert(mo.size() == 0);
7880
assert(std::distance(mo.begin(), mo.end()) == 0);

libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int main(int, char**)
3636
assert(std::distance(m.begin(), m.end()) == 0);
3737

3838
assert(mo.get_allocator() == A(7));
39+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
3940
assert(mo.key_comp() == C(5));
4041
assert(mo.size() == 0);
4142
assert(std::distance(mo.begin(), mo.end()) == 0);
@@ -67,6 +68,7 @@ int main(int, char**)
6768
assert(*std::next(m.begin(), 2) == 3);
6869

6970
assert(mo.get_allocator() == A(7));
71+
assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
7072
assert(mo.key_comp() == C(5));
7173
assert(mo.size() == 0);
7274
assert(std::distance(mo.begin(), mo.end()) == 0);

libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ int main(int, char**)
3939
assert(c1.size() == 0);
4040
assert(c3.get_allocator() == old_a);
4141
assert(c1.get_allocator() == A(1));
42+
assert(c1.get_allocator().get_id() == test_alloc_base::moved_value);
4243
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
4344
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
4445
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));

0 commit comments

Comments
 (0)