build: adding test
This commit is contained in:
parent
f47dd976db
commit
d522f89c00
1 changed files with 45 additions and 3 deletions
|
|
@ -6,16 +6,58 @@
|
||||||
/* 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/16 21:53:58 by rparodi ### ########.fr */
|
/* Updated: 2025/03/16 22:18:50 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "Bureaucrat.hpp"
|
#include "Bureaucrat.hpp"
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
|
std::cout << YELLOW << "\t\t[ Testing with the grade 0 ]" << RESET << std::endl;
|
||||||
try {
|
try {
|
||||||
Bureaucrat b1("Roger", 0);
|
Bureaucrat b1("Roger", 0);
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & err) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << std::endl << YELLOW << "\t\t[ Testing with the grade 151 ]" << RESET << std::endl;
|
||||||
|
try {
|
||||||
|
Bureaucrat b1("Robert", 151);
|
||||||
|
} catch (std::exception & err) {
|
||||||
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bureaucrat b1("Bob", 150);
|
||||||
|
std::cout << std::endl << YELLOW << "\t\t[ Testing with the demote a Bureaucrate level 150 ]" << RESET << std::endl;
|
||||||
|
try {
|
||||||
|
b1.demote();
|
||||||
|
} catch (std::exception & err) {
|
||||||
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl << b1 << std::endl << std::endl;
|
||||||
|
std::cout << std::endl << YELLOW << "\t\t[ Testing with the promote a Bureaucrate level 150 ]" << RESET << std::endl;
|
||||||
|
try {
|
||||||
|
b1.promote();
|
||||||
|
} catch (std::exception & err) {
|
||||||
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl << b1 << std::endl << std::endl;
|
||||||
|
|
||||||
|
Bureaucrat b2("Norminet", 1);
|
||||||
|
std::cout << std::endl << YELLOW << "\t\t[ Testing with the promote a Bureaucrate level 1 ]" << RESET << std::endl;
|
||||||
|
try {
|
||||||
|
b2.promote();
|
||||||
|
} catch (std::exception & err) {
|
||||||
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl << b2 << std::endl << std::endl;
|
||||||
|
std::cout << std::endl << YELLOW << "\t\t[ Testing with the demote a Bureaucrate level 1 ]" << RESET << std::endl;
|
||||||
|
try {
|
||||||
|
b2.demote();
|
||||||
|
} catch (std::exception & err) {
|
||||||
|
std::cerr << RED << err.what() << RESET << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl << b2 << std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue