Пример #1
0
int main(void) {
	Intern idiotOne;
	Bureaucrat hermes = Bureaucrat("Hermes Conrad", 37);
	Bureaucrat bob = Bureaucrat("Bobby Bobson", 123);
	OfficeBlock ob;
	ob.setIntern(idiotOne);
	ob.setSigner(bob);
	ob.setExecutor(hermes);
	try {
		ob.doBureaucracy("shrubbery creation", "Pigley");
	} catch (OfficeBlock::IncompleteOfficeException & e) {
		std::cout << e.what() << std::endl;
	} catch (Form::GradeTooLowException & e) {
		std::cout << e.what() << std::endl;
	}

	OfficeBlock	ob2;

	try {
		ob2.doBureaucracy("presidential pardon", "John Doe");
	} catch (OfficeBlock::IncompleteOfficeException & e) {
		std::cout << e.what() << std::endl;
	} catch (std::exception & e) {
		std::cout << e.what() << std::endl;
	}

	try {
		ob.doBureaucracy("cacac", "John Doe");
	} catch (OfficeBlock::IncompleteOfficeException & e) {
		std::cout << e.what() << std::endl;
	} catch (Intern::InvalidFormNameException & e) {
		std::cout << e.what() << std::endl;
	}
	return (0);
}
Пример #2
0
int main()
{
	{
	Intern idiotOne;
	Bureaucrat hermes = Bureaucrat("Hermes Conrad", 37);
	Bureaucrat bob = Bureaucrat("Bobby Bobson", 123);
	OfficeBlock ob;
	ob.setIntern(idiotOne);
	ob.setSigner(bob);
	ob.setExecutor(hermes);
	try {
		ob.doBureaucracy("mutant pig termination", "Pigley");
	} catch (std::exception& e) {
		std::cout << e.what() << std::endl;
	}
	}

	{
	Intern idiotOne;
	Bureaucrat hermes = Bureaucrat("Hermes Conrad", 1);
	Bureaucrat bob = Bureaucrat("Bobby Bobson", 1);
	OfficeBlock ob;
	ob.setIntern(idiotOne);
	ob.setSigner(bob);
	ob.setExecutor(hermes);
	try {
		ob.doBureaucracy("presidential pardon", "sysy");
	} catch (std::exception& e) {
		std::cout << e.what() << std::endl;
	}
	}

	return 0;
}
Пример #3
0
int main()
{
	Bureaucrat j = Bureaucrat("Bob", 30);
	Bureaucrat k = Bureaucrat("Giselle", 150);
	Bureaucrat l = Bureaucrat("Conrad", 2);
	std::cout << j << k << l;
	j.increasesGrade();
	k.increasesGrade();
	std::cout << j << k << l;
    k.decreasesGrade();
	k.decreasesGrade();
	std::cout << j << k << l;
	return (0);
}
Пример #4
0
int main( void ) {

    // b essaye de signer f mais il est trop noob pour ca
    Bureaucrat b = Bureaucrat("Michel", 20);
    Form f = Form("Traite sur la peche aux moules", 19, 1);
   b.signForm(f);
    // c'est bon la il peut signer youhou
   Form f2 = Form("Traite sur les poneys", 21, 1);
   std::cout << f2 << std::endl;
   std::cout << b << std::endl;
   b.signForm(f2);
    
    // tests de creation de form interdite
   try {

        Form test("lalala", 1, 1000);
    }
    catch (std::exception & e) {
        
        std::cout << e.what() << std::endl;
    }
    try {

        Form test("lalala", 1000, 1);
    }
    catch (std::exception & e) {
        
        std::cout << e.what() << std::endl;
    }
    ShrubberyCreationForm s("test");
    b.signForm(s);
    s.execute(b);
    return (0);
}
Пример #5
0
int			main(void)
{
	try {
		Bureaucrat	b1 = Bureaucrat("Bur 1", 1);
		ShrubberyCreationForm s1 = ShrubberyCreationForm("toto");
		RobotomyRequestForm r1 = RobotomyRequestForm("titi");
		PresidentialPardonForm p1 = PresidentialPardonForm("tutu");

		s1.beSigned(b1);
		s1.execute(b1);
		r1.beSigned(b1);
		r1.execute(b1);
		p1.beSigned(b1);

		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		b1.decGrade();
		std::cout << b1 << std::endl;
		b1.executeForm(p1);
	}
	catch (std::exception & e){
		std::cout << e.what() << std::endl;
	}

	return 0;
}