diff --git a/headers/tests_utils.hpp b/headers/tests_utils.hpp index 92eb10f..dd5c241 100644 --- a/headers/tests_utils.hpp +++ b/headers/tests_utils.hpp @@ -47,7 +47,7 @@ std::ostream & operator<<(std::ostream & o, mystruct const * rhs) { // ************************************ extern std::vector test_list; extern void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4); -std::vector mem_list_struct; +std::vector mem_list; // adding each test to the list @@ -101,7 +101,7 @@ template <> mystruct* val(int n) { mystruct *s = new mystruct(n); - mem_list_struct.push_back(s); + mem_list.push_back(s); return ( s ); } @@ -126,10 +126,11 @@ template void delete_structs() { std::vector::iterator it; - std::vector::iterator it_end = mem_list_struct.end(); + std::vector::iterator it_end = mem_list.end(); - for (it = mem_list_struct.begin(); it != it_end; ++it) + for (it = mem_list.begin(); it != it_end; ++it) delete *it; + mem_list.clear(); } diff --git a/tests/main.cpp b/tests/main.cpp index 9d93052..0b2632c 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -15,7 +15,7 @@ int main() { // tests_vector_rbegin(); // tests_vector_rend(); // tests_vector_size(); -// tests_vector_max_size(); + tests_vector_max_size(); tests_vector_resize(); // tests_vector_capacity(); // tests_vector_empty(); diff --git a/tests/tests_vectors.cpp b/tests/tests_vectors.cpp index 0dd832e..91c2611 100644 --- a/tests/tests_vectors.cpp +++ b/tests/tests_vectors.cpp @@ -19,6 +19,8 @@ TEST(tests_vector_constructor) ft::vector fifth (myints, myints + sizeof(myints) / sizeof(T) ); PRINT(fifth); + + DELETE } TEST(tests_vector_operator_assignation) @@ -44,6 +46,8 @@ TEST(tests_vector_operator_assignation) std::cout << "bar:\n"; PRINT(bar); + + DELETE } TEST(tests_vector_begin) @@ -56,6 +60,8 @@ TEST(tests_vector_begin) std::cout << "myvector contains:\n"; PRINT(myvector); + + DELETE } TEST(tests_vector_end) @@ -68,6 +74,8 @@ TEST(tests_vector_end) std::cout << "myvector contains:\n"; PRINT(myvector); + + DELETE } TEST(tests_vector_rbegin) @@ -85,6 +93,8 @@ TEST(tests_vector_rbegin) std::cout << "myvector contains:"; PRINT(myvector); + + DELETE } TEST(tests_vector_rend) @@ -102,6 +112,8 @@ TEST(tests_vector_rend) std::cout << "myvector contains:"; PRINT(myvector); + + DELETE } TEST(tests_vector_size) @@ -122,6 +134,8 @@ TEST(tests_vector_size) std::cout << "3. size: " << myarr.size() << '\n'; PRINT(myarr); + + DELETE } TEST(tests_vector_max_size) @@ -139,6 +153,8 @@ TEST(tests_vector_max_size) std::cout << "max_size: " << myvector.max_size() << "\n"; PRINT(myvector); + + DELETE } TEST(tests_vector_resize)