tests multi types

This commit is contained in:
hugogogo
2022-06-15 19:33:39 +02:00
parent 005382a3ac
commit bb4ac9963d
6 changed files with 200 additions and 136 deletions

View File

@@ -2,49 +2,40 @@
#include <string>
#include "colors.h"
#include <iomanip> // std::setw()
#include "tests.hpp"
// global declaration
std::ostream & operator<<(std::ostream & o, mystruct const & rhs) {
o << rhs.get_data()[0];
return (o);
}
std::vector<test_base *> test_list;
test_base *test;
std::string test_title;
#include "tests_proto.hpp"
int main() {
// VECTOR
tests_vector_constructor();
tests_vector_operator_assignation();
tests_vector_begin();
tests_vector_end();
tests_vector_rbegin();
tests_vector_rend();
tests_vector_size();
tests_vector_max_size();
tests_vector_resize();
tests_vector_capacity();
tests_vector_empty();
tests_vector_reserve();
tests_vector_operator_access();
tests_vector_at();
tests_vector_front();
tests_vector_back();
tests_vector_assign();
tests_vector_push_back();
tests_vector_pop_back();
tests_vector_insert();
tests_vector_erase();
tests_vector_swap();
tests_vector_clear();
tests_vector_get_allocator();
tests_vector_relational_operators();
tests_vector_swap_non_member();
tests_vector_reverse_iterators();
test_simple();
// tests_vector_constructor();
// tests_vector_operator_assignation();
// tests_vector_begin();
// tests_vector_end();
// tests_vector_rbegin();
// tests_vector_rend();
// tests_vector_size();
// tests_vector_max_size();
// tests_vector_resize();
// tests_vector_capacity();
// tests_vector_empty();
// tests_vector_reserve();
// tests_vector_operator_access();
// tests_vector_at();
// tests_vector_front();
// tests_vector_back();
// tests_vector_assign();
// tests_vector_push_back();
// tests_vector_pop_back();
// tests_vector_insert();
// tests_vector_erase();
// tests_vector_swap();
// tests_vector_clear();
// tests_vector_get_allocator();
// tests_vector_relational_operators();
// tests_vector_swap_non_member();
// tests_vector_reverse_iterators();
// MAP
// tests_map_constructor();
@@ -104,7 +95,8 @@ int main() {
{
std::cout
<< "\n" B_YELLOW "[" << i + 1 << "/" << size << "] "
<< test_list[i]->title << RESET "\n";
// << test_list[i]->title << RESET "\n";
<< RESET "\n";
test_list[i]->func();
}
std::cout << "\n";

View File

@@ -1,9 +1,24 @@
#ifndef TESTS_VECTORS_CPP
#define TESTS_VECTORS_CPP
#include "tests.hpp"
#include "tests_utils.hpp"
//TEST2(test_simple(), "test")
TEST(test_simple)
{
// title
TITLE(cplusplus.com reference)
T myints[] = {VAL(16),VAL(2),VAL(77),VAL(29)};
ft::vector<T> myvector (myints, myints + sizeof(myints) / sizeof(T) );
for (typename ft::vector<T>::iterator it = myvector.begin(); it != myvector.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
}
//TEST2END
/*
void tests_vector_constructor()
{
TEST(vector::vector (constructor))
@@ -1136,5 +1151,6 @@ void tests_vector_reverse_iterators()
}
TESTEND
}
*/
#endif