63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
#include "colors.h"
|
|
|
|
#include "easyfind.hpp"
|
|
#include <list>
|
|
#include <vector>
|
|
#include <deque>
|
|
|
|
#define N_TEST "3"
|
|
|
|
template < typename T >
|
|
void standardTest(T container, int test) {
|
|
typename T::const_iterator it;
|
|
|
|
for (int i = 65 ; i < 91 ; i++)
|
|
container.push_back(i);
|
|
for (it = container.begin(); it != container.end(); it++)
|
|
std::cout << *it << ": " << &*it << "\n";
|
|
std::cout << "\n";
|
|
try {
|
|
it = easyfind(container, test);
|
|
std::cout << *it << ": " << &*it << "\n\n";
|
|
}
|
|
catch (std::exception const & e) {
|
|
std::cout << test << ": " << e.what() << "\n\n";
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int i = 0;
|
|
|
|
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] "
|
|
<< "tests list :" RESET "\n";
|
|
{
|
|
std::list<int> container;
|
|
standardTest(container, 70);
|
|
std::list<char> container2;
|
|
standardTest(container2, 'T');
|
|
}
|
|
|
|
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] "
|
|
<< "tests vector :" RESET "\n";
|
|
{
|
|
std::vector<int> container;
|
|
standardTest(container, 70);
|
|
std::vector<char> container2;
|
|
standardTest(container2, 'T');
|
|
}
|
|
|
|
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] "
|
|
<< "tests deque :" RESET "\n";
|
|
{
|
|
std::deque<int> container;
|
|
standardTest(container, 70);
|
|
std::deque<char> container2;
|
|
standardTest(container2, 'T');
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|