58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#include "Bureaucrat.hpp"
|
|
#include "AForm.hpp"
|
|
#include "ShrubberyCreationForm.hpp"
|
|
#include "RobotomyRequestForm.hpp"
|
|
#include "PresidentialPardonForm.hpp"
|
|
|
|
int main() {
|
|
|
|
Bureaucrat tyty("tyty", 5);
|
|
Bureaucrat titi("titi", 25);
|
|
Bureaucrat toto("toto", 120);
|
|
Bureaucrat tata("tata", 150);
|
|
|
|
std::cout << "\n---Test0---\n" << std::endl;
|
|
|
|
try {
|
|
ShrubberyCreationForm shrube("toto");
|
|
ShrubberyCreationForm shrube2 = shrube;
|
|
std::cout << "shrube2 = shrube" << std::endl;
|
|
std::cout << "shrube2's name: " << shrube2.getName() << std::endl;
|
|
|
|
|
|
toto.executeForm(shrube2);
|
|
tata.executeForm(shrube);
|
|
}
|
|
catch (std::exception &e) {
|
|
std::cout << e.what() << std::endl;
|
|
}
|
|
|
|
std::cout << "\n---Test1---\n" << std::endl;
|
|
|
|
try {
|
|
RobotomyRequestForm roboto("toto");
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
tyty.executeForm(roboto);
|
|
toto.executeForm(roboto);
|
|
}
|
|
catch (std::exception &e) {
|
|
std::cout << e.what() << std::endl;
|
|
}
|
|
|
|
std::cout << "\n---Test2---\n" << std::endl;
|
|
|
|
try {
|
|
PresidentialPardonForm presi("tyty");
|
|
tyty.executeForm(presi);
|
|
titi.executeForm(presi);
|
|
toto.executeForm(presi);
|
|
tata.executeForm(presi);
|
|
}
|
|
catch (std::exception &e) {
|
|
std::cout << e.what() << std::endl;
|
|
}
|
|
|
|
std::cout << "\n---End Test---\n" << std::endl;
|
|
}
|