Skip to content

Commit 44ef12b

Browse files
authored
[libc++] Refactor tests for hijacked address operator in vector (#117457)
This reduces the amount of boilerplate needed to implement the tests.
1 parent 5bdcaf1 commit 44ef12b

12 files changed

+47
-281
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
//===----------------------------------------------------------------------===//
8+
9+
// UNSUPPORTED: c++03 && !stdlib=libc++
10+
11+
// <vector>
12+
13+
// Validate various member functions of std::vector with an ADL-hijacking operator&
14+
15+
#include <vector>
16+
#include <utility>
17+
18+
#include "operator_hijacker.h"
19+
#include "test_iterators.h"
20+
21+
using Vector = std::vector<operator_hijacker>;
22+
23+
void test(
24+
Vector v, Vector::const_iterator it, cpp17_input_iterator<operator_hijacker*> other_it, operator_hijacker val) {
25+
// emplace / insert
26+
v.emplace(it);
27+
v.insert(it, it, it);
28+
v.insert(it, other_it, other_it);
29+
v.insert(it, operator_hijacker());
30+
v.insert(it, 1, val);
31+
v.insert(it, val);
32+
33+
// erase
34+
v.erase(it);
35+
v.erase(it, it);
36+
37+
// assignment
38+
v = static_cast<Vector&>(v);
39+
v = std::move(v);
40+
41+
// construction
42+
{ Vector v2(std::move(v)); }
43+
{ Vector v2(std::move(v), std::allocator<operator_hijacker>()); }
44+
45+
// swap
46+
v.swap(v);
47+
}

libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.addressof.compile.pass.cpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.addressof.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.cons/move.addressof.compile.pass.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.addressof.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.addressof.compile.pass.cpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.addressof.compile.pass.cpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.addressof.compile.pass.cpp

Lines changed: 0 additions & 31 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.addressof.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.addressof.compile.pass.cpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.addressof.compile.pass.cpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector/vector.special/swap.addressof.compile.pass.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)