-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
84 lines (66 loc) · 1.82 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <algorithm>
#include "vec.hpp"
int main() {
std::ios::sync_with_stdio(0);
Vec<int> test = {1, 2, 3, 4, 5};
std::cout << "Inital vector: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
test.push_back(6);
test.push_back(7);
test.push_back(8);
std::cout << "Push back test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
test.pop_back();
std::cout << "Pop back test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
Vec<int> swapTest;
test.swap(swapTest);
std::cout << "Swap test: ";
for (std::size_t it = 0; it < swapTest.size(); ++it) {
std::cout << "[" << swapTest[it] << "] ";
}
swapTest.swap(test);
std::cout << "\n----------\n";
test.erase(0);
std::cout << "Erase test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
test.resize(5);
std::cout << "Resize test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
test.insert(0, 1);
std::cout << "Insert test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
test.clear();
std::cout << "Clear test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
std::fill(test.begin(), test.end(), 1);
std::cout << "Fill test: ";
for (const auto& i : test) {
std::cout << "[" << i << "] ";
}
std::cout << "\n----------\n";
std::cout << "Test done.\n";
return 0;
}