63 lines
1.1 KiB
C++
63 lines
1.1 KiB
C++
#include <iostream>
|
|
#include "colors.h"
|
|
#include "MutantStack.hpp"
|
|
|
|
#define N_TEST "1"
|
|
|
|
int main() {
|
|
int i = 0;
|
|
|
|
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] "
|
|
<< "test simple iterator :" RESET "\n";
|
|
{
|
|
MutantStack<int> mstack;
|
|
|
|
mstack.push(7);
|
|
mstack.push(987);
|
|
mstack.push(9);
|
|
mstack.push(8);
|
|
mstack.push(34);
|
|
mstack.push(1);
|
|
|
|
MutantStack<int>::iterator it = mstack.begin();
|
|
MutantStack<int>::iterator ite = mstack.end();
|
|
|
|
for (; it != ite; it++)
|
|
std::cout << *it << "\n";
|
|
}
|
|
|
|
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] "
|
|
<< "tests subject :" RESET "\n";
|
|
{
|
|
MutantStack<int> mstack;
|
|
|
|
mstack.push(5);
|
|
mstack.push(17);
|
|
|
|
std::cout << mstack.top() << std::endl;
|
|
mstack.pop();
|
|
std::cout << mstack.size() << std::endl;
|
|
|
|
mstack.push(3);
|
|
mstack.push(5);
|
|
mstack.push(737);
|
|
|
|
mstack.push(0);
|
|
MutantStack<int>::iterator it = mstack.begin();
|
|
MutantStack<int>::iterator ite = mstack.end();
|
|
|
|
++it;
|
|
--it;
|
|
|
|
while (it != ite)
|
|
{
|
|
std::cout << *it << std::endl;
|
|
++it;
|
|
}
|
|
std::stack<int> s(mstack);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|