-
Notifications
You must be signed in to change notification settings - Fork 2
/
testTimeSort.cpp
87 lines (71 loc) · 1.92 KB
/
testTimeSort.cpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "gtest/gtest.h"
#include "task.h"
#include "taskList.h"
#include "timeSort.h"
#include <string>
#include <vector>
#include <iostream>
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
TEST(testTimeSort, differentYears1) {
taskList list;
string t = "Task 1";
string d = "Finish LAB";
int h = 11;
string date = "11, 27, 2024";
char p = 'L';
list.createTask(t, d, date, h, p);
t = "Task 2";
d = "Finish hw";
date = "11, 27, 2023";
list.createTask(t, d, date, h, p);
t = "Task 3";
d = "Sleep";
date = "11, 27, 2022";
list.createTask(t, d, date, h, p);
vector<Task> listVector = list.getTimeVector();
Task first = listVector.at(0);
EXPECT_EQ(first.getDueDate(), "11, 27, 2022");
}
TEST(testTimeSort, differentYears2) {
taskList list;
string t = "Task 1";
string d = "Finish LAB";
int h = 11;
string date = "11, 27, 2024";
char p = 'M';
list.createTask(t, d, date, h, p);
t = "Task 2";
d = "Finish hw";
date = "11, 27, 2023";
list.createTask(t, d, date, h, p);
t = "Task 3";
d = "Sleep";
date = "11, 27, 2022";
list.createTask(t, d, date, h, p);
vector<Task> listVector = list.getTimeVector();
Task second = listVector.at(1);
EXPECT_EQ(second.getDueDate(), "11, 27, 2023");
}
TEST(testTimeSort, differentYears3) {
taskList list;
string t = "Task 1";
string d = "Finish LAB";
int h = 11;
string date = "11, 27, 2024";
char p = 'M';
list.createTask(t, d, date, h, p);
t = "Task 2";
d = "Finish hw";
date = "11, 27, 2023";
list.createTask(t, d, date, h, p);
t = "Task 3";
d = "Sleep";
date = "11, 27, 2022";
list.createTask(t, d, date, h, p);
vector<Task> listVector = list.getTimeVector();
Task third = listVector.at(2);
EXPECT_EQ(third.getDueDate(), "11, 27, 2024");
}