Exemplo n.º 1
0
int main(void)
{
	Bureaucrat a("Fry", 150);
	Bureaucrat b("Hermes Conrad", 36);
	Bureaucrat c("Number 1.0", 1);
	Intern someRandomIntern;
	/*Form d("Hard Contract", 78, 120);
	Form e("Hard Contract", 78, 151);
	Form f("Hard Contract", 152, 1);

	std::cout << b << std::endl;
	std::cout << d << std::endl;
	d.beSigned(a);
	std::cout << d << std::endl;
	a.signForm(d);
	b.signForm(d);
	a.signForm(d);
	std::cout << d << std::endl;
*/


	Form* fa;
	Form* fb;
	Form* fc;
	Form* fd;

	fa = someRandomIntern.makeForm("robotomy request", "Hermes");
	fb = someRandomIntern.makeForm("shrubbery creation request", "42");
	fc = someRandomIntern.makeForm("presidential pardon form", "Nixon");
	fd = someRandomIntern.makeForm("Fire intern", "Slave");
	//ShrubberyCreationForm	fa("42");
//	RobotomyRequestForm		fb("Hermes");
//	PresidentialPardonForm	fc("Nixon");

	std::cout << *fa << std::endl;
	std::cout << *fb << std::endl;
	std::cout << *fc << std::endl;
	b.signForm(*fa);
	b.signForm(*fb);
	std::cout << *fa << std::endl;
	std::cout << *fb << std::endl;
	std::cout << *fc << std::endl;
	b.executeForm(*fc);
	b.executeForm(*fa);
	std::cout << *fa << std::endl;
	std::cout << *fb << std::endl;
	std::cout << *fc << std::endl;
	b.signForm(*fc);
	c.signForm(*fc);
	b.executeForm(*fc);
	b.executeForm(*fb);
	c.executeForm(*fc);


	//Form* rrf;
	//rrf = someRandomIntern.makeForm("robotomy request", "Bender");

	return (0);
}
Exemplo n.º 2
0
int							main(void)
{
	Bureaucrat		b("Connard", Bureaucrat::lowestGrade);
	Bureaucrat		bo("Boss", Bureaucrat::highestGrade);
	Form			*f;
	
	Intern			i;
	std::cout << std::endl;

	std::cout << "f = i.makeForm(\"Test SuC\", \"targ\");" << std::endl;
	f = i.makeForm("Test SuC", "targ");
	std::cout << "f == " << (void*)f << std::endl;
	std::cout << std::endl;
	
	
	std::cout << "f = i.makeForm(\"robotomy request\", \"Bender\");" << std::endl;
	f = i.makeForm("robotomy request", "Bender");
	std::cout << "f == " << (void*)f << std::endl; delete f;
	std::cout << std::endl;

	std::cout << "f = i.makeForm(\"robotomy requesTFORM\", \"Bender\");" << std::endl;
	f = i.makeForm("robotomy requesTFORM", "Bender");
	std::cout << "f == " << (void*)f << std::endl; delete f;
	std::cout << std::endl;
	
	std::cout << "f = i.makeForm(\"robotomy request form\", \"Bender\");" << std::endl;
	f = i.makeForm("robotomy request form", "Bender");
	std::cout << "f == " << (void*)f << std::endl; delete f;
	std::cout << std::endl;
	
	std::cout << "f = i.makeForm(\"shrubberycreation\", \"Bender\");" << std::endl;
	f = i.makeForm("shrubberycreation", "Bender");
	std::cout << "f == " << (void*)f << std::endl; delete f;
	std::cout << std::endl;

	std::cout << "f = i.makeForm(\"presidenLOLtialpardon\", \"Bender\");" << std::endl;
	f = i.makeForm("presidenLOLtialpardon", "Bender");
	std::cout << "f == " << (void*)f << std::endl;
	std::cout << std::endl;
	std::cout << std::endl;
	std::cout << std::endl;

	std::cout << "f = i.makeForm(\"presidentialpardon\", \"Bender\");" << std::endl;
	f = i.makeForm("presidentialpardon", "Bender");
	std::cout << "f == " << (void*)f << std::endl;
	std::cout << std::endl;
	
	bo.signForm(*f);
	std::cout << std::endl;
	
	bo.executeForm(*f);
	 delete f;
	std::cout << std::endl;
	std::cout << std::endl;
	
	
	
	(void)b;
	(void)bo;
	return (0);
}
Exemplo n.º 3
-1
int main()
{
	Intern	paul;
	Form	*form = 0;

	form = paul.makeForm("toto", "tata");
	if (form) {
		std::cout << *form;
		delete form;
		form = 0;
	}
	form = paul.makeForm("shrubbery creation", "Tree");
	if (form) {
		std::cout << *form;
		delete form;
		form = 0;
	}
	form = paul.makeForm("robotomy request", "Blender");
	if (form) {
		std::cout << *form;
		delete form;
		form = 0;
	}
	form = paul.makeForm("presidential pardon", "Bill");
	if (form) {
		std::cout << *form;
		delete form;
		form = 0;
	}
	return 0;
}