-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting_main.cpp
More file actions
47 lines (42 loc) · 1.44 KB
/
testing_main.cpp
File metadata and controls
47 lines (42 loc) · 1.44 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
#include "Calendar.hpp"
#include "Event.hpp"
#include "CalendarInterface.hpp"
#include "ClassObserver.hpp"
#include "DayState.hpp"
#include "WeekState.hpp"
#include "MonthState.hpp"
#include <iostream>
using namespace std;
int main() {
CalendarInterface tester;
Calendar calendarObj;
Event* e = new Event(0, 1, "doctor", "check-up", "2");
calendarObj.addEvent(0, e);
calendarObj.addEvent(1, e);
calendarObj.addEvent(4, e);
calendarObj.addEvent(31, e);
calendarObj.addEvent(33, e);
calendarObj.addEvent(365, e);
cout << "Testing days..." << endl;
ClassObserver* obj = new DayState();
tester.attach(obj);
cout << "Passing in 0, expecting 1/1" << endl;
tester.getState(calendarObj, 0);
cout << "Passing in 50, expecting 2/20" << endl;
tester.getState(calendarObj, 50);
cout << "Passing in 365, expecting 12/31" << endl;
tester.getState(calendarObj, 365);
cout << "Now testing weeks..." << endl;
ClassObserver* obj2 = new WeekState();
tester.attach(obj2);
cout << "Passing in 0, expecting 1/1 - 1/7" << endl;
tester.getState(calendarObj, 0);
cout << "Passing in 364, expecting 12/30 - 1/5" << endl;
tester.getState(calendarObj, 364);
cout << "Now testing months..." << endl;
ClassObserver* obj3 = new MonthState();
tester.attach(obj3);
cout << "Passing in 2, expecting 2/1 - 2/29" << endl;
tester.getState(calendarObj, 2);
return 0;
}