Files
cpp03/ex00/main.cpp
T
2026-09-06 18:54:24 +02:00

31 lines
1.0 KiB
C++

#include "ClapTrap.hpp"
int main() {
std::cout << "\033[1;36m### TESTING CLAPTRAP ###\033[0m\n" << std::endl;
{
// Construction
std::cout << "\033[1;33m--- Construction ---\033[0m" << std::endl;
ClapTrap defaultBot;
ClapTrap namedBot("R2D2");
ClapTrap copiedBot(namedBot);
ClapTrap energyTest("EnergyBot");
ClapTrap deadBot("DeadBot");
// Tests basiques
std::cout << "\n\033[1;33m--- test ---\033[0m" << std::endl;
namedBot.attack("Enemy");
namedBot.takeDamage(3);
namedBot.beRepaired(2);
namedBot.takeDamage(5);
std::cout << "\n\033[1;33m--- ep test ---\033[0m" << std::endl;
for (int i = 0; i < 11; i++) {
energyTest.attack("practice_target");
}
std::cout << "\n\033[1;33m--- Death Test ---\033[0m" << std::endl;
deadBot.takeDamage(15); // >10
deadBot.attack("ghost"); // fails
std::cout << "\n\033[1;33m--- Destruction ---\033[0m" << std::endl;
}
return 0;
}