d08 ex02 fini, piscine finie :p
This commit is contained in:
62
d08/ex02/main.cpp
Normal file
62
d08/ex02/main.cpp
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user