MCPcopy Create free account
hub / github.com/Kitware/CMake / testAppend

Function testAppend

Tests/CMakeLib/testCMExtAlgorithm.cxx:12–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10int failed = 0;
11
12void testAppend()
13{
14 std::cout << "testAppend()" << std::endl;
15
16 // ----------------------------------------------------
17 // cm::append(Vector, Iterator, Iterator)
18 {
19 std::vector<int> v1{ 1, 2, 3 };
20 std::vector<int> v1_ref{ 1, 2, 3, 4, 5, 6 };
21 std::vector<int> v2{ 4, 5, 6 };
22 std::vector<int> v2_ref{ 4, 5, 6 };
23
24 cm::append(v1, v2.begin(), v2.end());
25
26 if (v1 != v1_ref || v2 != v2_ref) {
27 ++failed;
28 }
29 }
30
31 // ----------------------------------------------------
32 // cm::append(Vector, Range)
33 {
34 std::vector<int> v1{ 1, 2, 3 };
35 std::vector<int> v1_ref{ 1, 2, 3, 4, 5, 6 };
36 std::vector<int> v2{ 4, 5, 6 };
37 std::vector<int> v2_ref{ 4, 5, 6 };
38
39 cm::append(v1, v2);
40
41 if (v1 != v1_ref || v2 != v2_ref) {
42 ++failed;
43 }
44 }
45
46 // ----------------------------------------------------
47 // cm::append(Vector<*>, Vector<unique_ptr>)
48 {
49 std::vector<int*> v1{ new int(1), new int(2), new int(3) };
50 std::vector<int*> v1_ref = v1;
51 std::vector<std::unique_ptr<int>> v2;
52
53 v2.emplace_back(new int(4));
54 v2.emplace_back(new int(5));
55 v2.emplace_back(new int(6));
56
57 cm::append(v1, v2);
58
59 if (v1.size() == 6 && v2.size() == 3) {
60 for (int i = 0; i < 3; i++) {
61 if (v1[i] != v1_ref[i]) {
62 ++failed;
63 break;
64 }
65 }
66 for (int i = 0; i < 3; i++) {
67 if (v1[i + 3] != v2[i].get()) {
68 ++failed;
69 break;

Callers 1

testCMExtAlgorithmFunction · 0.70

Calls 8

appendFunction · 0.85
moveFunction · 0.85
emplace_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…