Files
cpp05/ex00/main.cpp
2026-02-16 23:36:12 +01:00

104 lines
2.8 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hadi <hadi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/16 22:32:41 by hadi #+# #+# */
/* Updated: 2026/02/16 23:35:56 by hadi ### ########.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);
}