add: form test
This commit is contained in:
		@ -3,6 +3,7 @@
 | 
			
		||||
 | 
			
		||||
int	main() {
 | 
			
		||||
 | 
			
		||||
	std::cout << "-------------Bureaucrat TEST-----------" << std::endl;
 | 
			
		||||
	std::cout << "Constructor too high grade" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		try {
 | 
			
		||||
@ -91,4 +92,95 @@ int	main() {
 | 
			
		||||
		std::cout << crat;
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "------------- Form TEST-----------" << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Constructor too high sign grade" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		try {
 | 
			
		||||
			Form("form", 42, 0);
 | 
			
		||||
		} catch (std::exception &e) {
 | 
			
		||||
			std::cout << e.what() << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Constructor too low sign grade" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		try {
 | 
			
		||||
			Form("form", 42, 151);
 | 
			
		||||
		} catch (std::exception &e) {
 | 
			
		||||
			std::cout << e.what() << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Constructor too high exec grade" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		try {
 | 
			
		||||
			Form("form", 0, 42);
 | 
			
		||||
		} catch (std::exception &e) {
 | 
			
		||||
			std::cout << e.what() << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Constructor too low exec grade" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		try {
 | 
			
		||||
			Form("form", 151, 42);
 | 
			
		||||
		} catch (std::exception &e) {
 | 
			
		||||
			std::cout << e.what() << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
	
 | 
			
		||||
	std::cout << "print" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		Form form("form", 42, 42);
 | 
			
		||||
		std::cout << form;
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
	
 | 
			
		||||
	std::cout << "------------- Form Sign TEST-----------" << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Bureaucrat sign a Form" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		Form form("form", 42, 42);
 | 
			
		||||
		Bureaucrat crat("crat", 42);
 | 
			
		||||
 | 
			
		||||
		crat.signForm(form);
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Too low Bureaucrat sign a Form" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		Form form("form", 42, 1);
 | 
			
		||||
		Bureaucrat crat("crat", 42);
 | 
			
		||||
		try	{
 | 
			
		||||
			crat.signForm(form);
 | 
			
		||||
		} catch (std::exception &e) {
 | 
			
		||||
			std::cout << e.what() << std::endl;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
	
 | 
			
		||||
	std::cout << "High Bureaucrat sign a low Form" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		Form form("form", 42, 150);
 | 
			
		||||
		Bureaucrat crat("crat", 1);
 | 
			
		||||
	
 | 
			
		||||
		crat.signForm(form);
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Form already sign" << std::endl;
 | 
			
		||||
	{
 | 
			
		||||
		Form form("form", 42, 150);
 | 
			
		||||
		Bureaucrat crat("crat", 1);
 | 
			
		||||
	
 | 
			
		||||
		crat.signForm(form);
 | 
			
		||||
		crat.signForm(form);
 | 
			
		||||
	}
 | 
			
		||||
	std::cout << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user