-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.cpp
More file actions
143 lines (104 loc) · 3.32 KB
/
Copy pathtests.cpp
File metadata and controls
143 lines (104 loc) · 3.32 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include "db.h"
#include "eligibility_check.h"
#include <iostream>
void createReadPatient() {
truncateDb();
Patient pt;
pt.name = "Mary";
bool s1 = (fileRead("db/Patient/last_id") == "0");
create(pt);
bool s2 = (fileRead("db/Patient/last_id") == "1");
Patient created = readPatient(1);
bool s3 = created.name == "Mary";
if (s1 and s2 and s3) {
std::cout << "createReadPatient: ok" << std::endl;
}
else {
std::cout << "createReadPatient: failed" << std::endl;
}
}
void createReadProvider() {
truncateDb();
Provider pr;
pr.name = "Mark";
bool s1 = (fileRead("db/Provider/last_id") == "0");
create(pr);
bool s2 = (fileRead("db/Provider/last_id") == "1");
Provider created = readProvider(1);
bool s3 = created.name == "Mark";
Provider pr2;
pr2.name = "Kim";
bool s4 = (fileRead("db/Provider/last_id") == "1");
create(pr2);
bool s5 = (fileRead("db/Provider/last_id") == "2");
Provider created2 = readProvider(2);
bool s6 = created2.name == "Kim";
if (s1 and s2 and s3 and s4 and s5 and s6) {
std::cout << "createReadProvider: ok" << std::endl;
}
else {
std::cout << "createReadProvider: failed" << std::endl;
}
}
void checkInNewPatient() {
//Patient came without appointment for the first time
truncateDb();
//TODO insertProviders();
// Write function which inserts providers for our clinic
insertPatients();
insertInsurers();
//Create new patient
Patient pt;
pt.name = "Mary";
Patient newPt = create(pt);
//Find his insurance company
Insurer ins = findInsurerByName("fidelis");
//Check if it exists in our database
bool s1 = (ins.name == "fidelis");
//Enter patient coverage to our database
Coverage cov;
cov.memberId = "464TLA";
cov.patientId = newPt.id;
cov.insurerId = ins.id;
Coverage ptCoverage = create(cov);
// Check if coverage is active
bool s2 = eligibilityCheck(ptCoverage.id);
// TODO Create encounter for our patient
// надо добавить функции на Create, Read и Print для визита (Encounter)
if (s1 and s2) {
std::cout << "checkInNewPatient: ok" << std::endl;
}
else {
std::cout << "checkInNewPatient: failed" << std::endl;
}
}
void checkInExistingPatient() {
// TODO add scenario when patient came for the second time
// and already has a coverage. Coverage is inactive
//
// TODO Надо добавить функцию поиска пациента по имени, как findInsurerByName
// TODO Надо добавить функцию поиска страховки по ID пациента
}
void deletePatientTest() {
truncateDb();
insertPatients();
deletePatient(1);
Patient pt = readPatient(1);
bool s1 = (pt.id == 0);
bool s2 = (fileRead("db/Patient/deleted") == "|1");
deletePatient(2);
bool s3 = (fileRead("db/Patient/deleted") == "|1|2");
if (s1 and s2 and s3) {
std::cout << "deletePatientTest: ok" << std::endl;
}
else {
std::cout << "deletePatientTest: failed" << std::endl;
}
}
int main() {
createReadPatient();
createReadProvider();
checkInNewPatient();
checkInExistingPatient();
deletePatientTest();
}