Files
cpp05/ex00/main.cpp
2026-02-21 12:15:22 +01:00

105 lines
2.8 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/21 11:35:39 by aortigos #+# #+# */
/* Updated: 2026/02/21 11:35:40 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "Bureaucrat/Bureaucrat.hpp"
int main()
{
std::cout << "---- ex00 tests ----" << std::endl;
try {
std::cout << "-> Bureaucrat with grade 0" << std::endl;
Bureaucrat hadi("Hadi", 0);
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
try {
std::cout << "-> Bureaucrat with grade 1" << std::endl;
Bureaucrat hadi("Hadi", 1);
std::cout << hadi << std::endl;
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
try {
std::cout << "-> Bureaucrat with grade 150" << std::endl;
Bureaucrat hadi("Hadi", 150);
std::cout << hadi << std::endl;
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
try {
std::cout << "-> Bureaucrat with grade 151" << std::endl;
Bureaucrat hadi("Hadi", 151);
std::cout << hadi << std::endl;
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
try {
std::cout << "-> Try increment grade from 1" << std::endl;
Bureaucrat hadi("Hadi", 1);
std::cout << hadi;
hadi.incrementGrade();
std::cout << hadi;
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
try {
std::cout << "-> Try increment grade from 2" << std::endl;
Bureaucrat hadi("Hadi", 2);
std::cout << hadi;
hadi.incrementGrade();
std::cout << hadi;
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
try {
std::cout << std::endl
<< "-> Try decrement grade from 150" << std::endl;
Bureaucrat hadi("Hadi", 150);
std::cout << hadi;
hadi.decrementGrade();
std::cout << hadi;
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
try {
std::cout << "-> Try decrement grade from 149" << std::endl;
Bureaucrat hadi("Hadi", 149);
std::cout << hadi;
hadi.decrementGrade();
std::cout << hadi;
} catch (std::exception &e) {
std::cout << e.what() << std::endl << std::endl;
}
return (0);
}