correction of valgrin error
This commit is contained in:
@@ -47,7 +47,7 @@ std::ostream & operator<<(std::ostream & o, mystruct const * rhs) {
|
||||
// ************************************
|
||||
extern std::vector<A_test*> test_list;
|
||||
extern void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4);
|
||||
std::vector<mystruct*> mem_list_struct;
|
||||
std::vector<mystruct*> 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 <class T>
|
||||
void delete_structs() {
|
||||
|
||||
std::vector<mystruct*>::iterator it;
|
||||
std::vector<mystruct*>::iterator it_end = mem_list_struct.end();
|
||||
std::vector<mystruct*>::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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -19,6 +19,8 @@ TEST(tests_vector_constructor)
|
||||
ft::vector<T> 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)
|
||||
|
||||
Reference in New Issue
Block a user