feat: adding tests

This commit is contained in:
Raphael 2025-03-19 17:13:24 +01:00
parent 5d81e1e176
commit 25ce5bdf0c

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/16 14:47:26 by rparodi #+# #+# */ /* Created: 2025/03/16 14:47:26 by rparodi #+# #+# */
/* Updated: 2025/03/19 16:10:42 by rparodi ### ########.fr */ /* Updated: 2025/03/19 17:13:07 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,6 +16,8 @@
#include "ShrubberyCreationForm.hpp" #include "ShrubberyCreationForm.hpp"
#include "RobotomyRequestForm.hpp" #include "RobotomyRequestForm.hpp"
#define SCF_LAUNCH 5
int main(void) { int main(void) {
std::cout << YELLOW << "\t\t[ Testing with the grade 0 ]" << RESET << std::endl; std::cout << YELLOW << "\t\t[ Testing with the grade 0 ]" << RESET << std::endl;
try { try {
@ -70,13 +72,26 @@ int main(void) {
std::cerr << RED << err.what() << RESET << std::endl; std::cerr << RED << err.what() << RESET << std::endl;
} }
std::cout << b2 << std::endl; std::cout << b2 << std::endl;
std::cout << std::endl << YELLOW << "\t\t[ Testing PresidentialPardonForm ]" << RESET << std::endl; std::cout << std::endl << YELLOW << "\t\t[ Testing PresidentialPardonForm (With permissions) ]" << RESET << std::endl;
PresidentialPardonForm ppf("Roger"); PresidentialPardonForm ppf("Roger");
b2.executeForm(ppf); b2.executeForm(ppf);
std::cout << std::endl << YELLOW << "\t\t[ Testing ShrubberyCreationForm ]" << RESET << std::endl;
std::cout << std::endl << YELLOW << "\t\t[ Testing PresidentialPardonForm (Without permissions) ]" << RESET << std::endl;
b1.executeForm(ppf);
std::cout << std::endl << YELLOW << "\t\t[ Testing ShrubberyCreationForm (With permissions) ]" << RESET << std::endl;
ShrubberyCreationForm scf("Roger"); ShrubberyCreationForm scf("Roger");
b2.executeForm(scf); b2.executeForm(scf);
std::cout << std::endl << YELLOW << "\t\t[ Testing ShrubberyCreationForm ]" << RESET << std::endl;
std::cout << std::endl << YELLOW << "\t\t[ Testing ShrubberyCreationForm (Without permissions) ]" << RESET << std::endl;
b1.executeForm(scf);
std::cout << std::endl << YELLOW << "\t\t[ Testing RobotomyRequestForm (With permissions) ]" << RESET << std::endl;
RobotomyRequestForm rrf("Roger"); RobotomyRequestForm rrf("Roger");
b2.executeForm(rrf); for (int i = 0; i < SCF_LAUNCH; i++) {
b2.executeForm(rrf);
}
std::cout << std::endl << YELLOW << "\t\t[ Testing RobotomyRequestForm (Without permissions) ]" << RESET << std::endl;
b1.executeForm(rrf);
} }