d05 ex02 ok pour Shrubbery form

This commit is contained in:
hugogogo
2022-03-04 20:58:15 +01:00
parent 130b228a2f
commit 0a5827f3a1
14 changed files with 297 additions and 194 deletions

View File

@@ -9,7 +9,9 @@
#define N_TEST "7"
int main() {
std::cout << B_YELLOW "\n[1/" N_TEST "] test subject :" RESET "\n";
int i = 0;
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] test subject :" RESET "\n";
{
const Animal* j = new Dog();
const Animal* i = new Cat();
@@ -17,7 +19,7 @@ int main() {
delete i;
}
std::cout << B_YELLOW "\n[2/" N_TEST "] test with brain :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] test with brain :" RESET "\n";
{
Dog * dog;
Cat * cat1;
@@ -64,7 +66,7 @@ int main() {
delete brain2;
}
std::cout << B_YELLOW "\n[3/" N_TEST "] array animal test :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] array animal test :" RESET "\n";
{
Animal *animals[10];
int i;
@@ -79,7 +81,7 @@ int main() {
delete animals[i];
}
std::cout << B_YELLOW "\n[4/" N_TEST "] copy constructor test1/2 :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] copy constructor test1/2 :" RESET "\n";
{
std::cout << B_BLUE "Cat a_cat :" RESET "\n";
Cat a_cat;
@@ -87,7 +89,7 @@ int main() {
Cat a_cpy_cat(a_cat);
}
std::cout << B_YELLOW "\n[5/" N_TEST "] copy constructor test2/2 :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] copy constructor test2/2 :" RESET "\n";
{
std::cout << B_BLUE "Cat a_cat :" RESET "\n";
Cat a_cat;
@@ -95,7 +97,7 @@ int main() {
Cat a_cpy_cat = a_cat;
}
std::cout << B_YELLOW "\n[6/" N_TEST "] assignation operator test1 :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] assignation operator test1 :" RESET "\n";
{
std::cout << B_BLUE "Cat a_cat :" RESET "\n";
Cat a_cat;
@@ -105,7 +107,7 @@ int main() {
a_cpy_cat = a_cat;
}
std::cout << B_YELLOW "\n[7/" N_TEST "] assignation operator test2 :" RESET "\n";
std::cout << B_YELLOW "\n[" << ++i << "/" N_TEST "] assignation operator test2 :" RESET "\n";
{
std::cout << B_BLUE "const Cat *a_cat :" RESET "\n";
const Cat *a_cat = new Cat();
@@ -117,7 +119,32 @@ int main() {
delete a_cat;
}
return 0;
}
/*
#include <vector>
#include <functional>
#include <iostream>
int main()
{
std::vector<std::function<void()>> tests;
tests.push_back(
[](){
std::cout << "hello test\n";
}
);
tests.push_back(
[](){
std::cout << "hello another test.\n";
}
);
int counter = 0;
for (const auto& test : tests){
std::cout << ++counter << "/" << tests.size() << " ";
test();
}
}
*/

Binary file not shown.