-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (53 loc) · 1.09 KB
/
main.cpp
File metadata and controls
61 lines (53 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "AForm.hpp"
#include "Bureaucrat.hpp"
#include "Intern.hpp"
#include "PresidentialPardonForm.hpp"
#include "RobotomyRequestForm.hpp"
#include "ShrubberyCreationForm.hpp"
#include "print.hpp"
namespace Tests
{
void
basic_tests ()
{
Intern Intern;
Bureaucrat batman ("batman", 1);
AForm *form;
form = Intern.makeForm ("presidential pardon", "target");
form->beSigned (batman);
form->execute (batman);
delete form;
form = Intern.makeForm ("robotomy request", "target");
form->beSigned (batman);
form->execute (batman);
delete form;
form = Intern.makeForm ("shrubbery creation", "target");
form->beSigned (batman);
form->execute (batman);
delete form;
}
void
exceptions_tests ()
{
Intern Intern;
Bureaucrat batman ("batman", 1);
AForm *form;
try
{
form = Intern.makeForm ("nope", "target");
}
catch (std::exception &e)
{
print (e.what ());
}
}
}
int
main (void)
{
print (GREEN TITTLE "Basic Tests" RESET);
Tests::basic_tests ();
print (GREEN TITTLE "Class not found exception" RESET);
Tests::exceptions_tests ();
return 0;
}