#include "iassert.h" #include "vec.h" int main() { { Vec *v = new Vec(); delete v; } Vec v; v.push_back(10); ASSERT_MSG(v[0] == 10, "10 should be present at index 0"); Vec v2{1, 2, 3}; ASSERT_MSG(v2.size() == 3, "Size should be three"); v2.pop_back(); ASSERT_MSG(v2.size() == 2, "Size should be three"); // Triggers a reallocation (memcpy) Vec v3{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; ASSERT_MSG(v3[11] == 12, "Index 11 should hold 12"); // ASSERT_MSG(v3[5] == 6, "Index 5 should hold 6"); // ??? ASSERT_MSG(v3.size() == 12, "Size should be 12"); ASSERT_MSG(v3.capacity() == 20, "Capacity should be 20"); for (const auto &a : v3) { std::cout << a << std::endl; } }