From 72762a79cbe59b1847b31a16f2c530f20eb117d2 Mon Sep 17 00:00:00 2001 From: hugogogo Date: Fri, 17 Jun 2022 15:30:58 +0200 Subject: [PATCH] re-organisation of files --- Makefile | 4 +- headers/map.hpp | 166 ++++ headers/tests.hpp | 132 +++ headers/tests_proto.hpp | 32 +- headers/tests_utils.hpp | 6 +- templates/map.tpp | 120 +++ templates/vector.tpp | 766 ------------------ tests/main.cpp | 79 +- tests/tests_map.cpp | 551 +++++++++++++ tests/tests_utils.cpp | 117 +++ tests/{tests_vectors.cpp => tests_vector.cpp} | 4 +- 11 files changed, 1165 insertions(+), 812 deletions(-) create mode 100644 headers/map.hpp create mode 100644 headers/tests.hpp create mode 100644 templates/map.tpp create mode 100644 tests/tests_map.cpp create mode 100644 tests/tests_utils.cpp rename tests/{tests_vectors.cpp => tests_vector.cpp} (99%) diff --git a/Makefile b/Makefile index e86aaee..3853e3e 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,9 @@ INCLUDES = -I$(D_HEADERS) \ D_SRCS = ./tests #SRCS = main42.cpp SRCS = main.cpp \ - tests_vectors.cpp + tests_vector.cpp + +# tests_map.cpp D_HEADERS = ./headers HEADERS = colors.h \ diff --git a/headers/map.hpp b/headers/map.hpp new file mode 100644 index 0000000..80001fc --- /dev/null +++ b/headers/map.hpp @@ -0,0 +1,166 @@ + +#ifndef MAP_HPP +# define MAP_HPP + +//# include "colors.h" +//# include +//# include +//# include // std::allocator +//# include // std::min, std::max +//# include // out_of_range, length_error, logic_error +//# include // NULL, std::size_t, std::ptrdiff_t +// +//# include "enable_if.hpp" +//# include "is_integral.hpp" +//# include "reverse_iterator.hpp" +//# include "equal.hpp" +//# include "lexicographical_compare.hpp" + +namespace ft { + +//template < +// class T, +// class Allocator = std::allocator > +class map { + +public: + +// typedef T value_type; +// typedef Allocator allocator_type; +// typedef std::size_t size_type; +// typedef std::ptrdiff_t difference_type; +// +// typedef T * iterator; +// typedef T const * const_iterator; +// typedef ft::reverse_iterator reverse_iterator; +// typedef ft::reverse_iterator const_reverse_iterator; +// +// // dependent qualified name : +// // https://en.cppreference.com/w/cpp/keyword/typename +// typedef typename Allocator::reference reference; +// typedef typename Allocator::const_reference const_reference; + + + + /************ + * copliens : + ************/ +//// constructors ------------------------------ +// explicit map (const key_compare& comp = key_compare(), +// const allocator_type& alloc = allocator_type()); +// template +// map (InputIterator first, InputIterator last, +// const key_compare& comp = key_compare(), +// const allocator_type& alloc = allocator_type()); +// map (const map& x); +//// destructor -------------------------------- +// ~map(); +//// operator= --------------------------------- +// map& operator= (const map& x); + + + /************* + * iterators : + *************/ +//// begin ------------------------------------- +// iterator begin(); +// const_iterator begin() const; +//// end --------------------------------------- +// iterator end(); +// const_iterator end() const; +//// rbegin ------------------------------------ +// reverse_iterator rbegin(); +// const_reverse_iterator rbegin() const; +//// rend -------------------------------------- +// reverse_iterator rend(); +// const_reverse_iterator rend() const; + + + /************ + * capacity : + ************/ +//// empty ------------------------------------- +// bool empty() const; +//// size -------------------------------------- +// size_type size() const; +//// max_size ---------------------------------- +// size_type max_size() const; + + + /****************** + * element access : + ******************/ +//// operator[] -------------------------------- +// mapped_type & operator[] (const key_type& k); + + + /************* + * modifiers : + *************/ +//// insert ------------------------------------ +// pair insert (const value_type& val); +// iterator insert (iterator position, const value_type& val); +// template +// void insert (InputIterator first, InputIterator last); +//// erase ------------------------------------- +// void erase (iterator position); +// size_type erase (const key_type& k); +// void erase (iterator first, iterator last); +//// swap -------------------------------------- +// void swap (map& x); +//// clear ------------------------------------- +// void clear(); + + + /************* + * observers : + *************/ +//// key_comp ---------------------------------- +// key_compare key_comp() const; +//// value_comp -------------------------------- +// value_compare value_comp() const; + + + /************** + * operations : + **************/ +//// find -------------------------------------- +// iterator find (const key_type& k); +// const_iterator find (const key_type& k) const; +//// count ------------------------------------- +// size_type count (const key_type& k) const; +//// lower_bound ------------------------------- +// iterator lower_bound (const key_type& k); +// const_iterator lower_bound (const key_type& k) const; +//// upper_bound ------------------------------- +// iterator upper_bound (const key_type& k); +// const_iterator upper_bound (const key_type& k) const; +//// equal_range ------------------------------- +// pair equal_range (const key_type& k) const; +// pair equal_range (const key_type& k); + + + /************* + * allocator : + *************/ +//// get_allocator ----------------------------- +// allocator_type get_allocator() const; + +private: + +// size_type _size; +// size_type _capacity; +// value_type * _mem_ptr; +// allocator_type _allocator; +// +// void _destroy(iterator first, iterator last); +// void _increment_capacity(size_type n); + +}; + +} // namespace ft + +# include "map.tpp" + +#endif + diff --git a/headers/tests.hpp b/headers/tests.hpp new file mode 100644 index 0000000..1ec119e --- /dev/null +++ b/headers/tests.hpp @@ -0,0 +1,132 @@ +#ifndef TESTS_HPP +# define TESTS_HPP + +#include "colors.h" +#include +#include +#include // std::setw() +#include // std::reverse_iterator +#include // std::make_pair +#include // std::stringstream + + + +// toogle between test ft and stl +// ************************* +#include +#include +#ifdef STL + namespace ft = std; +#else + #include "vector.hpp" + #include "reverse_iterator.hpp" +#endif + + +// global variables +// *************************************** +std::vector< std::vector > test_list; +std::vector mem_list; + + + +// global functions +// *************************************** +void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4); + + +// struct for tests +// *************************************** +struct mystruct { +public: + mystruct(int data = 0); + ~mystruct(); + int * get_data() const; +private: + int * _val; +}; +std::ostream & operator<<(std::ostream & o, mystruct const * rhs); + + +// adding each test to the list +// *************************** +#define TEST(f_name) \ + template struct s_ ## f_name : public A_test\ + { void func(); };\ + void f_name ()\ + { add_to_list(\ + #f_name,\ + new(s_ ## f_name ),\ + new(s_ ## f_name ),\ + new(s_ ## f_name ),\ + new(s_ ## f_name )\ + );}\ + template \ + void s_ ## f_name ::func() + + +// defines +// **************************************** +# define TITLE(s) std::cout << "\n" B_PURPLE #s RESET "\n\n"; +# define VAL(n) val(n) +# define TOI(n) toi(n) +# define PRINT(n) print_vector(n); +# define DELETE delete_structs(); + + +// prototypes +// ********************************************* +// vectors +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(); +// map +void tests_map_simple(); +//void tests_map_constructor(); +//void tests_map_operator_assignation(); +//void tests_map_begin(); +//void tests_map_end(); +//void tests_map_rbegin(); +//void tests_map_rend(); +//void tests_map_empty(); +//void tests_map_size(); +//void tests_map_max_size(); +//void tests_map_operator_access(); +//void tests_map_insert(); +//void tests_map_erase(); +//void tests_map_swap(); +//void tests_map_clear(); +//void tests_map_key_comp(); +//void tests_map_value_comp(); +//void tests_map_find(); +//void tests_map_count(); +//void tests_map_lower_bound(); +//void tests_map_upper_bound(); +//void tests_map_equal_range(); +//void tests_map_get_allocator(); +#endif + diff --git a/headers/tests_proto.hpp b/headers/tests_proto.hpp index 7e9631b..9485930 100644 --- a/headers/tests_proto.hpp +++ b/headers/tests_proto.hpp @@ -27,8 +27,8 @@ void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4) } -// ********************************************* -// prototypes +// ************************************** +// prototypes vector void tests_vector_constructor(); void tests_vector_operator_assignation(); void tests_vector_begin(); @@ -57,5 +57,33 @@ void tests_vector_relational_operators(); void tests_vector_swap_non_member(); void tests_vector_reverse_iterators(); + +// ***************************************** +// prototypes map +void tests_map_simple(); +//void tests_map_constructor(); +//void tests_map_operator_assignation(); +//void tests_map_begin(); +//void tests_map_end(); +//void tests_map_rbegin(); +//void tests_map_rend(); +//void tests_map_empty(); +//void tests_map_size(); +//void tests_map_max_size(); +//void tests_map_operator_access(); +//void tests_map_insert(); +//void tests_map_erase(); +//void tests_map_swap(); +//void tests_map_clear(); +//void tests_map_key_comp(); +//void tests_map_value_comp(); +//void tests_map_find(); +//void tests_map_count(); +//void tests_map_lower_bound(); +//void tests_map_upper_bound(); +//void tests_map_equal_range(); +//void tests_map_get_allocator(); + + #endif diff --git a/headers/tests_utils.hpp b/headers/tests_utils.hpp index 1dc4941..3c01673 100644 --- a/headers/tests_utils.hpp +++ b/headers/tests_utils.hpp @@ -5,12 +5,14 @@ #include "A_test.hpp" #include #include -#include #include // std::setw() #include // std::reverse_iterator #include // std::make_pair #include // std::map -#include +#include // std::stringstream + +#include +#include // toogle between test ft and stl diff --git a/templates/map.tpp b/templates/map.tpp new file mode 100644 index 0000000..e0a451d --- /dev/null +++ b/templates/map.tpp @@ -0,0 +1,120 @@ + +//#define VT_TPL template +//#define VT vector + +//#define MP_TPL template < typename Key, typename T, typename Compare, typename Allocator > +//#define MP map + + +namespace ft { + + + /************ + * copliens : + ************/ +//// constructors ------------------------------ +// explicit map (const key_compare& comp = key_compare(), +// const allocator_type& alloc = allocator_type()); +// template +// map (InputIterator first, InputIterator last, +// const key_compare& comp = key_compare(), +// const allocator_type& alloc = allocator_type()); +// map (const map& x); +//// destructor -------------------------------- +// ~map(); +//// operator= --------------------------------- +// map& operator= (const map& x); + + + /************* + * iterators : + *************/ +//// begin ------------------------------------- +// iterator begin(); +// const_iterator begin() const; +//// end --------------------------------------- +// iterator end(); +// const_iterator end() const; +//// rbegin ------------------------------------ +// reverse_iterator rbegin(); +// const_reverse_iterator rbegin() const; +//// rend -------------------------------------- +// reverse_iterator rend(); +// const_reverse_iterator rend() const; + + + /************ + * capacity : + ************/ +//// empty ------------------------------------- +// bool empty() const; +//// size -------------------------------------- +// size_type size() const; +//// max_size ---------------------------------- +// size_type max_size() const; + + + /****************** + * element access : + ******************/ +//// operator[] -------------------------------- +// mapped_type & operator[] (const key_type& k); + + + /************* + * modifiers : + *************/ +//// insert ------------------------------------ +// pair insert (const value_type& val); +// iterator insert (iterator position, const value_type& val); +// template +// void insert (InputIterator first, InputIterator last); +//// erase ------------------------------------- +// void erase (iterator position); +// size_type erase (const key_type& k); +// void erase (iterator first, iterator last); +//// swap -------------------------------------- +// void swap (map& x); +//// clear ------------------------------------- +// void clear(); + + + /************* + * observers : + *************/ +//// key_comp ---------------------------------- +// key_compare key_comp() const; +//// value_comp -------------------------------- +// value_compare value_comp() const; + + + /************** + * operations : + **************/ +//// find -------------------------------------- +// iterator find (const key_type& k); +// const_iterator find (const key_type& k) const; +//// count ------------------------------------- +// size_type count (const key_type& k) const; +//// lower_bound ------------------------------- +// iterator lower_bound (const key_type& k); +// const_iterator lower_bound (const key_type& k) const; +//// upper_bound ------------------------------- +// iterator upper_bound (const key_type& k); +// const_iterator upper_bound (const key_type& k) const; +//// equal_range ------------------------------- +// pair equal_range (const key_type& k) const; +// pair equal_range (const key_type& k); + + + /************* + * allocator : + *************/ +//// get_allocator ----------------------------- +// allocator_type get_allocator() const; + +} // namespace ft + +//#undef VT +//#undef VT_TPL + diff --git a/templates/vector.tpp b/templates/vector.tpp index ff6cabb..39533b0 100644 --- a/templates/vector.tpp +++ b/templates/vector.tpp @@ -5,7 +5,6 @@ namespace ft { - /********************************************* * COPLIENS *********************************************/ @@ -64,13 +63,11 @@ VT_TPL VT & VT:: vector new_vector; - //Base::operator=(rhs); if ( this != &rhs ) { new_vector.reserve(_capacity); new_vector.assign(rhs.begin(), rhs.end()); swap(new_vector); - //_size = rhs.size(); } return *this; } @@ -460,20 +457,6 @@ VT_TPL void VT:: -/********************************************* - * NESTED CLASS - *********************************************/ -//void vector::Class::function() {} - - - -/********************************************* - * STATICS - *********************************************/ -//std::string const vector::_bar = "bar"; - - - /************************ * non-member functions : ************************/ @@ -511,752 +494,3 @@ VT_TPL #undef VT #undef VT_TPL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/////////////////////////////////////////////////////////////////: - - - -/////////////////////////////////////////////////////////////////: - - - - - - - - -/////////////////////////////////////////////////////////////////// - - - - - -/////////////////////////////////////////////////////////////////: - - - - - - - - -//////////////////////////////////////////////////////: - - - - - -/////////////////////////////////////////////////////////////: - - - - - -/////////////////////////////////////////////////////////// - - - - -// #define VT_TPL template -// #define VT vector -// -// namespace ft { -// -// -// -// /********************************************* -// * COPLIENS -// *********************************************/ -// // constructors ------------------------------ -// VT_TPL VT:: -// vector( const Allocator & alloc ) -// : _size(0) -// , _capacity(0) -// , _mem_ptr(NULL) -// , _allocator(alloc) { -// -// return; -// } -// VT_TPL VT:: -// vector( size_type n, const T & val, const Allocator & alloc ) -// : _size(0) -// , _capacity(0) -// , _mem_ptr(NULL) -// , _allocator(alloc) { -// -// assign(n, val); -// return; -// } -// VT_TPL template VT:: -// vector(InputIterator first, InputIterator last, const Allocator & alloc) -// : _size(0) -// , _capacity(0) -// , _mem_ptr(NULL) -// , _allocator(alloc) { -// -// assign(first, last); -// return; -// } -// // copy constructor -------------------------- -// VT_TPL VT:: -// vector( vector const & src ) -// : _size(0) -// , _capacity(0) -// , _mem_ptr(NULL) -// , _allocator(src._allocator) { -// -// *this = src; -// return; -// } -// // destructors ------------------------------- -// VT_TPL VT:: -// ~vector() { return; } -// // operator= --------------------------------- -// VT_TPL VT & VT:: -// operator=( vector const & rhs ) { -// -// vector new_vector; -// -// //Base::operator=(rhs); -// if ( this != &rhs ) -// { -// new_vector.reserve(_capacity); -// new_vector.assign(rhs.begin(), rhs.end()); -// swap(new_vector); -// //_size = rhs.size(); -// } -// return *this; -// } -// -// -// -// /************* -// * iterators : -// *************/ -// // begin ------------------------------------- -// VT_TPL typename VT::iterator VT:: -// begin() { return _mem_ptr; } -// VT_TPL typename VT::const_iterator VT:: -// begin() const { return _mem_ptr; } -// // end --------------------------------------- -// VT_TPL typename VT::iterator VT:: -// end() { return &_mem_ptr[_size]; } -// VT_TPL typename VT::const_iterator VT:: -// end() const { return &_mem_ptr[_size]; } -// // rbegin ------------------------------------ -// VT_TPL typename VT::reverse_iterator VT:: -// rbegin() { return reverse_iterator(end()); } -// VT_TPL typename VT::const_reverse_iterator VT:: -// rbegin() const { return const_reverse_iterator(end()); } -// // rend -------------------------------------- -// VT_TPL typename VT::reverse_iterator VT:: -// rend() { return reverse_iterator(begin()); } -// VT_TPL typename VT::const_reverse_iterator VT:: -// rend() const { return const_reverse_iterator(begin()); } -// -// -// -// /************ -// * capacity : -// ************/ -// // size -------------------------------------- -// VT_TPL typename VT::size_type VT:: -// size( ) const { return _size; } -// // max_size ---------------------------------- -// VT_TPL typename VT::size_type VT:: -// max_size() const { return (_allocator.max_size()); } -// // resize ------------------------------------ -// VT_TPL void VT:: -// resize(size_type n, value_type val) { -// -// if (n > _size) -// { -// if (n > _capacity) -// _increment_capacity(n); -// while (_size != n) -// { -// _allocator.construct(&_mem_ptr[_size], val); -// ++_size; -// } -// } -// else if (n < _size) -// { -// while (_size != n) -// _allocator.destroy(&_mem_ptr[--_size]); -// } -// } -// // capacity ---------------------------------- -// VT_TPL typename VT::size_type VT:: -// capacity() const { return _capacity; } -// // empty ------------------------------------- -// VT_TPL bool VT:: -// empty() const { return (_size == 0); } -// // reserve ----------------------------------- -// VT_TPL void VT:: -// reserve( size_type new_cap ) { -// -// T* new_arr; -// T* old_arr = _mem_ptr; -// -// if (new_cap > max_size()) -// throw std::length_error("vector::reserve"); -// -// if (_capacity >= new_cap) -// return ; -// new_arr = _allocator.allocate(new_cap); -// -// if (old_arr) -// { -// iterator first = begin(); -// iterator last = end(); -// _mem_ptr = new_arr; -// _size = 0; -// assign(first, last); -// _destroy(first, last); -// _allocator.deallocate(old_arr, _capacity); -// } -// else -// _mem_ptr = new_arr; -// -// _capacity = new_cap; -// -// -// // value_type * tmp_ptr; -// // value_type * old_ptr = _mem_ptr; -// // iterator first = begin(); -// // iterator last = end(); -// // -// // if (new_cap > _allocator.max_size()) -// // throw std::length_error("reserve: new_cap > max_size"); -// // if (_capacity == _allocator.max_size()) -// // throw std::length_error("reserve: capacity == max_size"); -// // if (new_cap <= _capacity) -// // return ; -// // -// // _capacity = new_cap; -// // tmp_ptr = _allocator.allocate(new_cap); -// // -// // if (_mem_ptr) -// // { -// // _mem_ptr = tmp_ptr; -// // _size = 0; -// // assign(first, last); -// // _destroy(begin(), end()); -// // _allocator.deallocate(old_ptr, _capacity); -// // } -// // _mem_ptr = tmp_ptr; -// } -// -// -// -// /****************** -// * element access : -// ******************/ -// // operator[] -------------------------------- -// VT_TPL typename VT::reference VT:: -// operator[](size_type n) { return _mem_ptr[n]; } -// VT_TPL typename VT::const_reference VT:: -// operator[](size_type n) const { return _mem_ptr[n]; } -// // at ---------------------------------------- -// VT_TPL typename VT::reference VT:: -// at(size_type n) { -// -// if (n >= _size) -// throw std::out_of_range("vector out of range"); -// return (_mem_ptr[n]); -// } -// VT_TPL typename VT::const_reference VT:: -// at(size_type n) const { -// -// if (n >= _size) -// throw std::out_of_range("vector out of range"); -// return (_mem_ptr[n]); -// } -// // front ------------------------------------- -// VT_TPL typename VT::reference VT:: -// front() { return (*_mem_ptr); } -// VT_TPL typename VT::const_reference VT:: -// front() const { return (*_mem_ptr); } -// // back -------------------------------------- -// VT_TPL typename VT::reference VT:: -// back() { return (_mem_ptr[_size - 1]); } -// VT_TPL typename VT::const_reference VT:: -// back() const { return (_mem_ptr[_size - 1]); } -// -// -// -// /************* -// * modifiers : -// *************/ -// // assign ------------------------------------ -// VT_TPL template -// typename enable_if< !is_integral::value,void >::type VT:: -// assign( InputIterator first, InputIterator last) { -// -// _assign(first, last, typename iterator_traits::iterator_category()); -// -// // InputIterator tmp = first; -// // unsigned int range = 0; -// // -// // clear(); -// // -// // while (tmp++ != last) -// // range++; -// // if (range >= _capacity) -// // _increment_capacity(range); -// // while (first != last) -// // { -// // _allocator.construct(&_mem_ptr[_size], *first); -// // first++; -// // _size++; -// // } -// } -// VT_TPL -// template < typename InputIt > -// void VT:: -// _assign(InputIt first, InputIt last, std::input_iterator_tag) -// { -// clear(); -// -// while (first != last) -// { -// if (_size + 1 > _capacity) -// _increment_capacity(_size + 1); -// _allocator.construct(&_mem_ptr[_size], *first); -// ++first; -// ++_size; -// } -// } -// VT_TPL -// template < typename ForwardIt > -// void VT:: -// _assign(ForwardIt first, ForwardIt last, std::forward_iterator_tag) -// { -// clear(); -// -// difference_type diff = std::distance(first, last); -// if (diff < 0) -// throw std::logic_error("Wrong iterator order"); -// -// if (static_cast(diff) > _capacity) -// _increment_capacity(diff); -// -// while (first != last) -// { -// _allocator.construct(&_mem_ptr[_size], *first); -// ++first; -// ++_size; -// } -// } -// -// -// VT_TPL void VT:: -// assign( size_type n, const T & val ) { -// -// if (n > _allocator.max_size()) -// throw std::length_error("assign: n > max_size"); -// -// value_type * tmp_ptr; -// -// _destroy(begin(), end()); -// if (n > _capacity) -// { -// _capacity = n; -// tmp_ptr = _allocator.allocate(n); -// if (_mem_ptr) -// _allocator.deallocate(_mem_ptr, _capacity); -// _mem_ptr = tmp_ptr; -// } -// _size = n; -// while (n) -// _allocator.construct(&_mem_ptr[--n], val); -// } -// // push_back --------------------------------- -// VT_TPL void VT:: -// push_back( const value_type & element ) { -// -// if (_size >= _capacity) -// _increment_capacity(1); -// _allocator.construct(&_mem_ptr[_size], element); -// _size++; -// } -// // pop_back ---------------------------------- -// VT_TPL void VT:: -// pop_back() { _allocator.destroy(end() - 1); _size--; } -// // insert ------------------------------------ -// VT_TPL typename VT::iterator VT:: -// insert(iterator pos, const value_type& value) { -// // insert(iterator position, const value_type& val) { -// -// if (_size + 1 > _capacity) -// { -// difference_type offset = pos - begin(); -// _increment_capacity(_size + 1); -// pos = begin() + offset; -// } -// -// iterator it_end = end(); -// if (pos != it_end) -// { -// iterator i = it_end; -// --i; -// _allocator.construct(i + 1, *i); -// while (i != pos) -// { -// --i; -// *(i + 1) = *i; -// } -// _allocator.destroy(pos); -// } -// _allocator.construct(pos, value); -// _size += 1; -// return (pos); -// -// -// -// // difference_type distance; -// // iterator it; -// // -// // if (_size + 1 > _capacity) -// // { -// // distance = position - begin(); -// // _increment_capacity(1); -// // position = begin() + distance; -// // } -// // it = end(); -// // if (position != it) -// // { -// // _allocator.construct(it, *(it - 1)); -// // while (it-- != position) -// // *(it + 1) = *it; -// // } -// // _allocator.destroy(position); -// // _allocator.construct(position, val); -// // _size++; -// // return (position); -// } -// VT_TPL void VT:: -// insert(iterator pos, size_type count, const value_type& value) { -// // insert(iterator position, size_type n, const value_type& val) { -// -// if (_size + count > _capacity) -// { -// difference_type offset = pos - begin(); -// // _auto_realloc(_size + count); -// _increment_capacity(count); -// pos = begin() + offset; -// } -// -// iterator it_end = end(); -// if (pos != it_end) -// { -// iterator i = it_end; -// while (i + count != it_end && i != pos) -// { -// --i; -// _allocator.construct(i + count, *i); -// } -// while (i != pos) -// { -// --i; -// *(i + count) = *i; -// } -// // _destroy_objects(pos, std::min(pos + count, it_end)); -// _destroy(pos, std::min(pos + count, it_end)); -// } -// -// iterator last = pos + count; -// while (pos != last) -// { -// _allocator.construct(pos, value); -// ++pos; -// } -// _size += count; -// -// // difference_type distance; -// // iterator it_end; -// // iterator it; -// // -// // if (_size + n > _capacity) -// // { -// // distance = position - begin(); -// // _increment_capacity(n); -// // position = begin() + distance; -// // } -// // -// // it_end = end(); -// // if (position != it_end) -// // { -// // it = it_end; -// // while (it + n != it_end && it != position) -// // { -// // it--; -// // _allocator.construct(it + n, *it); -// // } -// // while (it != position) -// // { -// // it--; -// // *(it + n) = *it; -// // } -// // _destroy(position, std::min(position + n, it_end)); -// // } -// // -// // for (size_type i = 0; i < n; i++, position++) -// // _allocator.construct(position, val); -// // _size += n; -// } -// VT_TPL template -// typename enable_if< !is_integral::value,void >::type VT:: -// insert(iterator position, InputIterator first, InputIterator last) { -// -// difference_type dist; -// difference_type n; -// iterator it_end; -// iterator it; -// -// n = std::distance(first, last); -// if (_size + n > _capacity) -// { -// dist = position - begin(); -// _increment_capacity(n); -// position = begin() + dist; -// } -// -// it_end = end(); -// if (position != it_end) -// { -// it = it_end; -// while (it + n != it_end && it != position) -// { -// it--; -// _allocator.construct(it + n, *it); -// } -// while (it != position) -// { -// it--; -// *(it + n) = *it; -// } -// _destroy(position, std::min(position + n, it_end)); -// } -// -// while (first != last) -// { -// _allocator.construct(position, *first); -// ++position; -// ++first; -// } -// -// _size += n; -// } -// // erase ------------------------------------- -// VT_TPL typename VT::iterator VT:: -// erase(iterator position) { -// -// iterator i = position; -// iterator it_end = end() - 1; -// -// while (i != it_end) -// { -// *i = *(i + 1); -// ++i; -// } -// _allocator.destroy(it_end); -// _size -= 1; -// return (position); -// } -// VT_TPL typename VT::iterator VT:: -// erase(iterator first, iterator last) { -// -// iterator it_end = end(); -// difference_type diff = std::distance(first, last); -// -// if (diff <= 0) -// return (first); -// -// it_end = end(); -// while (last != it_end) -// { -// *first = *last; -// first++; -// last++; -// } -// _destroy(it_end - diff, it_end); -// _size -= diff; -// -// return (first); -// } -// // swap -------------------------------------- -// VT_TPL void VT:: -// swap(vector& x) { -// -// T* tmp_mem_ptr; -// size_type tmp_size; -// size_type tmp_capacity; -// -// tmp_mem_ptr = x._mem_ptr; -// tmp_size = x._size; -// tmp_capacity = x._capacity; -// -// x._mem_ptr = _mem_ptr; -// x._size = _size; -// x._capacity = _capacity; -// -// _mem_ptr = tmp_mem_ptr; -// _size = tmp_size; -// _capacity = tmp_capacity; -// } -// // clear ------------------------------------- -// VT_TPL void VT:: -// clear() { _destroy(begin(), end()); _size = 0; } -// -// -// -// /************* -// * allocator : -// *************/ -// // get_allocator ----------------------------- -// VT_TPL typename VT::allocator_type VT:: -// get_allocator() const { return (_allocator); } -// -// -// -// /********************************************* -// * PRIVATE MEMBER FUNCTIONS -// *********************************************/ -// VT_TPL void VT:: -// _destroy(iterator first, iterator last) { -// -// while (first != last) -// { -// _allocator.destroy(first); -// first++; -// } -// } -// VT_TPL void VT:: -// _increment_capacity(size_type min_new_cap) { -// // _increment_capacity(size_type n) { -// -// size_type new_cap; -// -// if (_capacity == max_size()) -// throw std::length_error("vector::reserve"); -// new_cap = std::min(max_size() / 2, _size) * 2; -// new_cap = std::max(new_cap, min_new_cap); -// reserve(new_cap); -// -// -// // size_type res; -// // -// // res = std::max(_size * 2, n); -// // reserve(std::min(res, _allocator.max_size())); -// } -// -// -// -// /********************************************* -// * NESTED CLASS -// *********************************************/ -// //void vector::Class::function() {} -// -// -// -// /********************************************* -// * STATICS -// *********************************************/ -// //std::string const vector::_bar = "bar"; -// -// -// -// /************************ -// * non-member functions : -// ************************/ -// // operator == ------------------------------- -// VT_TPL -// bool operator== (const VT & lhs, const VT & rhs) { -// -// if (lhs.size() != rhs.size()) -// return false; -// return ft::equal(lhs.begin(), lhs.end(), rhs.begin()); -// } -// // operator < -------------------------------- -// VT_TPL -// bool operator< (const VT & lhs, const VT & rhs) { -// -// return ft::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); -// } -// // operator != ------------------------------- -// VT_TPL -// bool operator!= (const VT & lhs, const VT & rhs) { return !(lhs == rhs); } -// // operator <= ------------------------------- -// VT_TPL -// bool operator<= (const VT & lhs, const VT & rhs) { return !(lhs > rhs); } -// // operator > -------------------------------- -// VT_TPL -// bool operator> (const VT & lhs, const VT & rhs) { return (rhs < lhs); } -// // operator >= ------------------------------- -// VT_TPL -// bool operator>= (const VT & lhs, const VT & rhs) { return !(lhs < rhs); } -// // swap (vector) ------------------------------- -// VT_TPL -// void swap (VT & lhs, VT & rhs) { lhs.swap(rhs); } -// -// } // namespace ft -// -// #undef VT -// #undef VT_TPL -// diff --git a/tests/main.cpp b/tests/main.cpp index ef91e8f..ca6944f 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,67 +1,68 @@ #include #include -#include "colors.h" #include // std::setw() -#include "tests_proto.hpp" +#include "colors.h" +#include "A_test.hpp" +//#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(); +// 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_simple(); // tests_map_constructor(); // tests_map_operator_assignation(); // tests_map_begin(); // tests_map_end(); // tests_map_rbegin(); // tests_map_rend(); +// tests_map_empty(); // tests_map_size(); // tests_map_max_size(); -// tests_map_resize(); -// tests_map_capacity(); -// tests_map_empty(); -// tests_map_reserve(); // tests_map_operator_access(); -// tests_map_at(); -// tests_map_front(); -// tests_map_back(); -// tests_map_assign(); -// tests_map_push_back(); -// tests_map_pop_back(); // tests_map_insert(); // tests_map_erase(); // tests_map_swap(); // tests_map_clear(); +// tests_map_key_comp(); +// tests_map_value_comp(); +// tests_map_find(); +// tests_map_count(); +// tests_map_lower_bound(); +// tests_map_upper_bound(); +// tests_map_equal_range(); // tests_map_get_allocator(); + // STACK // tests_stack_constructor(); // tests_stack_operator_assignation(); diff --git a/tests/tests_map.cpp b/tests/tests_map.cpp new file mode 100644 index 0000000..7af511a --- /dev/null +++ b/tests/tests_map.cpp @@ -0,0 +1,551 @@ + +#ifndef TESTS_MAP_CPP +#define TESTS_MAP_CPP + +#include "tests_utils.hpp" + +TEST(tests_map_simple) +{ + // title + TITLE(simple test) + + std::map first; + std::map::iterator it; + + first['a']=10; + first['b']=30; + first['c']=50; + first['d']=70; + + for(it=first.begin(); it!=first.end(); ++it){ + std::cout << it->first << " => " << it->second << '\n'; + } + + DELETE +} + +/* +TEST(tests_map_constructor) +{ + // title + TITLE(cplusplus.com reference) + + // bool fncomp (char lhs, char rhs) {return lhs first; + + first['a']=10; + first['b']=30; + first['c']=50; + first['d']=70; + + std::map second (first.begin(),first.end()); + + std::map third (second); + + std::map fourth; // class as Compare + + bool(*fn_pt)(char,char) = fncomp; + std::map fifth (fn_pt); // function pointer as Compare + + DELETE +} + +TEST(tests_map_operator_assignation) +{ + // title + TITLE(cplusplus.com reference) + + std::map first; + std::map second; + + first['x']=8; + first['y']=16; + first['z']=32; + + second=first; // second now contains 3 ints + first=std::map(); // and first is now empty + + std::cout << "Size of first: " << first.size() << '\n'; + std::cout << "Size of second: " << second.size() << '\n'; + + DELETE +} + +TEST(tests_map_begin) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['b'] = 100; + mymap['a'] = 200; + mymap['c'] = 300; + + // show content: + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_end) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['b'] = 100; + mymap['a'] = 200; + mymap['c'] = 300; + + // show content: + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_rbegin) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['x'] = 100; + mymap['y'] = 200; + mymap['z'] = 300; + + // show content: + std::map::reverse_iterator rit; + for (rit=mymap.rbegin(); rit!=mymap.rend(); ++rit) + std::cout << rit->first << " => " << rit->second << '\n'; + + DELETE +} + +TEST(tests_map_rend) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['x'] = 100; + mymap['y'] = 200; + mymap['z'] = 300; + + // show content: + std::map::reverse_iterator rit; + for (rit=mymap.rbegin(); rit!=mymap.rend(); ++rit) + std::cout << rit->first << " => " << rit->second << '\n'; + + DELETE +} + +TEST(tests_map_empty) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['a']=10; + mymap['b']=20; + mymap['c']=30; + + while (!mymap.empty()) + { + std::cout << mymap.begin()->first << " => " << mymap.begin()->second << '\n'; + mymap.erase(mymap.begin()); + } + + DELETE +} + +TEST(tests_map_size) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + mymap['a']=101; + mymap['b']=202; + mymap['c']=302; + + std::cout << "mymap.size() is " << mymap.size() << '\n'; + + DELETE +} + +TEST(tests_map_max_size) +{ + // title + TITLE(cplusplus.com reference) + + int i; + std::map mymap; + + if (mymap.max_size()>1000) + { + for (i=0; i<1000; i++) mymap[i]=0; + std::cout << "The map contains 1000 elements.\n"; + } + else std::cout << "The map could not hold 1000 elements.\n"; + + DELETE +} + +TEST(tests_map_operator_access) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['a']="an element"; + mymap['b']="another element"; + mymap['c']=mymap['b']; + + std::cout << "mymap['a'] is " << mymap['a'] << '\n'; + std::cout << "mymap['b'] is " << mymap['b'] << '\n'; + std::cout << "mymap['c'] is " << mymap['c'] << '\n'; + std::cout << "mymap['d'] is " << mymap['d'] << '\n'; + + std::cout << "mymap now contains " << mymap.size() << " elements.\n"; + + DELETE +} + +TEST(tests_map_insert) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + // first insert function version (single parameter): + mymap.insert ( std::pair('a',100) ); + mymap.insert ( std::pair('z',200) ); + + std::pair::iterator,bool> ret; + ret = mymap.insert ( std::pair('z',500) ); + if (ret.second==false) { + std::cout << "element 'z' already existed"; + std::cout << " with a value of " << ret.first->second << '\n'; + } + + // second insert function version (with hint position): + std::map::iterator it = mymap.begin(); + mymap.insert (it, std::pair('b',300)); // max efficiency inserting + mymap.insert (it, std::pair('c',400)); // no max efficiency inserting + + // third insert function version (range insertion): + std::map anothermap; + anothermap.insert(mymap.begin(),mymap.find('c')); + + // showing contents: + std::cout << "mymap contains:\n"; + for (it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + std::cout << "anothermap contains:\n"; + for (it=anothermap.begin(); it!=anothermap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_erase) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + std::map::iterator it; + + // insert some values: + mymap['a']=10; + mymap['b']=20; + mymap['c']=30; + mymap['d']=40; + mymap['e']=50; + mymap['f']=60; + + it=mymap.find('b'); + mymap.erase (it); // erasing by iterator + + mymap.erase ('c'); // erasing by key + + it=mymap.find ('e'); + mymap.erase ( it, mymap.end() ); // erasing by range + + // show content: + for (it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_swap) +{ + // title + TITLE(cplusplus.com reference) + + std::map foo,bar; + + foo['x']=100; + foo['y']=200; + + bar['a']=11; + bar['b']=22; + bar['c']=33; + + foo.swap(bar); + + std::cout << "foo contains:\n"; + for (std::map::iterator it=foo.begin(); it!=foo.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + std::cout << "bar contains:\n"; + for (std::map::iterator it=bar.begin(); it!=bar.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_clear) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['x']=100; + mymap['y']=200; + mymap['z']=300; + + std::cout << "mymap contains:\n"; + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + mymap.clear(); + mymap['a']=1101; + mymap['b']=2202; + + std::cout << "mymap contains:\n"; + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_key_comp) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + std::map::key_compare mycomp = mymap.key_comp(); + + mymap['a']=100; + mymap['b']=200; + mymap['c']=300; + + std::cout << "mymap contains:\n"; + + char highest = mymap.rbegin()->first; // key value of last element + + std::map::iterator it = mymap.begin(); + do { + std::cout << it->first << " => " << it->second << '\n'; + } while ( mycomp((*it++).first, highest) ); + + std::cout << '\n'; + + DELETE +} + +TEST(tests_map_value_comp) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['x']=1001; + mymap['y']=2002; + mymap['z']=3003; + + std::cout << "mymap contains:\n"; + + std::pair highest = *mymap.rbegin(); // last element + + std::map::iterator it = mymap.begin(); + do { + std::cout << it->first << " => " << it->second << '\n'; + } while ( mymap.value_comp()(*it++, highest) ); + + DELETE +} + +TEST(tests_map_find) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + std::map::iterator it; + + mymap['a']=50; + mymap['b']=100; + mymap['c']=150; + mymap['d']=200; + + it = mymap.find('b'); + if (it != mymap.end()) + mymap.erase (it); + + // print content: + std::cout << "elements in mymap:" << '\n'; + std::cout << "a => " << mymap.find('a')->second << '\n'; + std::cout << "c => " << mymap.find('c')->second << '\n'; + std::cout << "d => " << mymap.find('d')->second << '\n'; + + DELETE +} + +TEST(tests_map_count) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + char c; + + mymap ['a']=101; + mymap ['c']=202; + mymap ['f']=303; + + for (c='a'; c<'h'; c++) + { + std::cout << c; + if (mymap.count(c)>0) + std::cout << " is an element of mymap.\n"; + else + std::cout << " is not an element of mymap.\n"; + } + + DELETE +} + +TEST(tests_map_lower_bound) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + std::map::iterator itlow,itup; + + mymap['a']=20; + mymap['b']=40; + mymap['c']=60; + mymap['d']=80; + mymap['e']=100; + + itlow=mymap.lower_bound ('b'); // itlow points to b + itup=mymap.upper_bound ('d'); // itup points to e (not d!) + + mymap.erase(itlow,itup); // erases [itlow,itup) + + // print content: + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_upper_bound) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + std::map::iterator itlow,itup; + + mymap['a']=20; + mymap['b']=40; + mymap['c']=60; + mymap['d']=80; + mymap['e']=100; + + itlow=mymap.lower_bound ('b'); // itlow points to b + itup=mymap.upper_bound ('d'); // itup points to e (not d!) + + mymap.erase(itlow,itup); // erases [itlow,itup) + + // print content: + for (std::map::iterator it=mymap.begin(); it!=mymap.end(); ++it) + std::cout << it->first << " => " << it->second << '\n'; + + DELETE +} + +TEST(tests_map_equal_range) +{ + // title + TITLE(cplusplus.com reference) + + std::map mymap; + + mymap['a']=10; + mymap['b']=20; + mymap['c']=30; + + std::pair::iterator,std::map::iterator> ret; + ret = mymap.equal_range('b'); + + std::cout << "lower bound points to: "; + std::cout << ret.first->first << " => " << ret.first->second << '\n'; + + std::cout << "upper bound points to: "; + std::cout << ret.second->first << " => " << ret.second->second << '\n'; + + DELETE +} + +TEST(tests_map_get_allocator) +{ + // title + TITLE(cplusplus.com reference) + + int psize; + std::map mymap; + std::pair* p; + + // allocate an array of 5 elements using mymap's allocator: + p=mymap.get_allocator().allocate(5); + + // assign some values to array + psize = sizeof(std::map::value_type)*5; + + std::cout << "The allocated array has a size of " << psize << " bytes.\n"; + + mymap.get_allocator().deallocate(p,5); + + DELETE +} + +*/ + +#endif + diff --git a/tests/tests_utils.cpp b/tests/tests_utils.cpp new file mode 100644 index 0000000..427d86a --- /dev/null +++ b/tests/tests_utils.cpp @@ -0,0 +1,117 @@ + +#include "tests.hpp" + +void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4) { + + std::vector test_sub_list; + + s1->title = s; + s2->title = s; + s3->title = s; + s4->title = s; + s1->type = "int"; + s2->type = "char"; + s3->type = "std::string"; + s4->type = "mystruct"; + test_sub_list.push_back(s1); + test_sub_list.push_back(s2); + test_sub_list.push_back(s3); + test_sub_list.push_back(s4); + test_list.push_back(test_sub_list); +} + +void delete_structs() { + + std::vector::iterator it; + std::vector::iterator it_end = mem_list.end(); + + for (it = mem_list.begin(); it != it_end; ++it) + delete *it; + mem_list.clear(); +} + +template + void print_vector(ft::vector vec) { + + int i = 0; + typename ft::vector::iterator it; + typename ft::vector::iterator it_end = vec.end(); + + for (it = vec.begin(); it != it_end; ++it, i++) + std::cout << "[" << i << "]" << *it << " "; + std::cout << "\nsize:" << vec.size() << " capacty:" << vec.capacity() << "\n"; +} + +// mystruct +// ********************************************* +mystruct::mystruct(int data) {_val = new int[2]; _val[0] = data; _val[1] = data;} +mystruct::~mystruct() {delete[] _val;} +int * mystruct::get_data() const {return _val;} +std::ostream & operator<<(std::ostream & o, mystruct const * rhs) { + if (rhs != NULL) + o << (*rhs).get_data()[0] << "," << (*rhs).get_data()[1]; + else + o << "NULL"; + return (o); +} + + +// get a value +// ********************************************* +template + T val(int n) {(void)n; return (T()); +} +template <> + int val(int n) {return (n); +} +template <> + char val(int n) {return (n % 94 + 33); +} +template <> + std::string val(int n) { + + std::string str; + std::stringstream stream; + + stream << n; + stream >> str; + stream.clear(); + return (str); +} +template <> + mystruct* val(int n) { + + mystruct *s = new mystruct(n); + mem_list.push_back(s); + return ( s ); +} + + +// convert a value +// ***************************************** +template + int toi(T t) {(void)t; return (0); +} +template <> + int toi(int i) {return (i); +} +template <> + int toi(char c) {return (c); +} +template <> + int toi(std::string str) { + + int i; + std::stringstream stream; + + stream << str; + stream >> i; + stream.clear(); + return (i); +} +template <> + int toi(mystruct* s) { + + return ( s->get_data()[0] ); +} + diff --git a/tests/tests_vectors.cpp b/tests/tests_vector.cpp similarity index 99% rename from tests/tests_vectors.cpp rename to tests/tests_vector.cpp index 9576855..5ca40fe 100644 --- a/tests/tests_vectors.cpp +++ b/tests/tests_vector.cpp @@ -1,6 +1,6 @@ -#ifndef TESTS_VECTORS_CPP -#define TESTS_VECTORS_CPP +#ifndef TESTS_VECTOR_CPP +#define TESTS_VECTOR_CPP #include "tests_utils.hpp"