/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Main.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: toi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/01/15 10:00:00 by toi #+# #+# */ /* Updated: 2025/01/15 10:00:00 by toi ### ########.fr */ /* */ /* ************************************************************************** */ #include "Bureaucrat.hpp" #include "Form.hpp" int main(void) { std::cout << "\033[35m" << std::endl << "Test ex01" << "\033[0m" << std::endl; std::cout << "\033[31m" << std::endl << "Test creation trop haut et trop bas" << "\033[0m" << std::endl; try { Bureaucrat Dormeur1("Bernard", 1500); } catch(const std::exception &e) { std::cerr << "Exception catch: " << e.what() << std::endl; } try { Bureaucrat Dormeur2("Olivier", -10); } catch(const std::exception &e) { std::cerr << "Exception catch: " << e.what() << std::endl; } std::cout << "\033[32m" << std::endl << "Test augmentation" << "\033[0m" << std::endl; Bureaucrat robert("Robert", 2); std::cout << robert; try { robert.incrementGrade(); } catch(const std::exception& e) { std::cerr << "Exception catch: " << e.what() << std::endl; } std::cout << robert; try { robert.incrementGrade(); } catch(const std::exception& e) { std::cerr << "Exception catch: " << e.what() << std::endl; } std::cout << robert; std::cout << "\033[33m" << std::endl << "Test diminution" << "\033[0m" << std::endl; Bureaucrat thomas("Thomas", 149); std::cout << thomas; try { thomas.decrementGrade(); } catch(const std::exception& e) { std::cerr << "Exception catch: " << e.what() << std::endl; } std::cout << thomas; try { thomas.decrementGrade(); } catch(const std::exception& e) { std::cerr << "Exception catch: " << e.what() << std::endl; } std::cout << thomas; std::cout << "\033[34m" << std::endl << "Test signatures de formulaires" << "\033[0m" << std::endl; Form formulaire_id("FORMULAIRE IDENTITE", 100, 90); Bureaucrat mr_lent; Bureaucrat mr_identite("MR_IDENTITE", 100); std::cout << formulaire_id; mr_lent.signForm(formulaire_id); std::cout << formulaire_id; mr_identite.signForm(formulaire_id); std::cout << formulaire_id; return (0); }