d08 ex02 fini, piscine finie :p

This commit is contained in:
hugogogo
2022-03-14 12:53:25 +01:00
parent 2f90a1ee13
commit 2e68c5daef
5 changed files with 196 additions and 0 deletions

62
d08/ex02/main.cpp Normal file
View File

@@ -0,0 +1,62 @@
#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;
}