tests multi types
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
#ifndef TESTS_HPP
|
||||
# define TESTS_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "colors.h"
|
||||
#include <vector>
|
||||
#include <iomanip> // std::setw()
|
||||
#include <iterator> // std::reverse_iterator
|
||||
#include <utility> // std::make_pair
|
||||
#include <map> // std::map
|
||||
|
||||
|
||||
// *************************
|
||||
// toogle between test ft and stl
|
||||
#ifdef STL
|
||||
namespace ft = std;
|
||||
#else
|
||||
#include "vector.hpp"
|
||||
#include "reverse_iterator.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
// ***************************
|
||||
// adding each test to the list
|
||||
# define TEST(s) \
|
||||
{\
|
||||
test_title = #s;\
|
||||
struct tester : public test_base {\
|
||||
void func()
|
||||
# define TESTEND \
|
||||
};\
|
||||
test = new(tester);\
|
||||
test->title = test_title;\
|
||||
test_list.push_back(test);\
|
||||
}
|
||||
|
||||
|
||||
// *******************************
|
||||
// vector of functions test
|
||||
struct test_base { std::string title; virtual void func(){} };
|
||||
extern std::vector<test_base *> test_list;
|
||||
extern test_base *test;
|
||||
extern std::string test_title;
|
||||
|
||||
|
||||
// *************************************
|
||||
// defines for titles
|
||||
# define TITLE(s) std::cout << "\n" B_PURPLE #s RESET "\n\n";
|
||||
|
||||
|
||||
// ***************************************
|
||||
// struct for tests
|
||||
struct mystruct {
|
||||
public:
|
||||
mystruct(int data = 1) {_val = new int[1]; _val[0] = data;}
|
||||
~mystruct() {delete[] _val;}
|
||||
int * get_data() const {return _val;}
|
||||
private:
|
||||
int * _val;
|
||||
};
|
||||
extern std::ostream & operator<<(std::ostream & o, mystruct const & rhs);
|
||||
|
||||
|
||||
// *********************************************
|
||||
// prototypes
|
||||
void tests_vector_constructor();
|
||||
void tests_vector_operator_assignation();
|
||||
void tests_vector_begin();
|
||||
void tests_vector_end();
|
||||
void tests_vector_rbegin();
|
||||
void tests_vector_rend();
|
||||
void tests_vector_size();
|
||||
void tests_vector_max_size();
|
||||
void tests_vector_resize();
|
||||
void tests_vector_capacity();
|
||||
void tests_vector_empty();
|
||||
void tests_vector_reserve();
|
||||
void tests_vector_operator_access();
|
||||
void tests_vector_at();
|
||||
void tests_vector_front();
|
||||
void tests_vector_back();
|
||||
void tests_vector_assign();
|
||||
void tests_vector_push_back();
|
||||
void tests_vector_pop_back();
|
||||
void tests_vector_insert();
|
||||
void tests_vector_erase();
|
||||
void tests_vector_swap();
|
||||
void tests_vector_clear();
|
||||
void tests_vector_get_allocator();
|
||||
void tests_vector_relational_operators();
|
||||
void tests_vector_swap_non_member();
|
||||
void tests_vector_reverse_iterators();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user