-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (35 loc) · 1.9 KB
/
Copy pathmain.cpp
File metadata and controls
45 lines (35 loc) · 1.9 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
#include "customer_managment.h"
#include <iostream>
int main() {
CustomerManagmentDatabase db;
const std::string TEST_DB = "test_db";
std::cout << "=== TEST 1: Create Database ===" << std::endl;
bool test1 = db.CreateDatabase(TEST_DB);
std::cout << (test1 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== TEST 2: Add Customer ===" << std::endl;
bool test2 = db.AddNewCustomer(TEST_DB, "John", "Doe", "john@email.com", "+123456789");
std::cout << (test2 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== TEST 3: Find Customer ===" << std::endl;
Customer found = db.FindCustomer(TEST_DB, "John", "Doe", "john@email.com");
if (found.id != 0) {
std::cout << "PASS - Customer found: " << found.first_name << " " << found.second_name << std::endl;
}
else {
std::cout << "FAIL - Customer not found" << std::endl;
}
std::cout << std::endl;
std::cout << "=== TEST 4: Add Phone ===" << std::endl;
bool test4 = db.AddPhoneNumber(TEST_DB, "+987654321", "john@email.com");
std::cout << (test4 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== TEST 5: Update Customer ===" << std::endl;
bool test5 = db.UpgradeCustomer(TEST_DB, "john@email.com", "Jonathan", "Doe", "jonathan@email.com", "+111111111");
std::cout << (test5 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== TEST 6: Delete Phone ===" << std::endl;
bool test6 = db.DeletePhoneNumber(TEST_DB, "+987654321", "jonathan@email.com");
std::cout << (test6 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== TEST 7: Delete Customer ===" << std::endl;
bool test7 = db.DeleteCustomer(TEST_DB, "jonathan@email.com");
std::cout << (test7 ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "=== ALL TESTS COMPLETED ===" << std::endl;
return 0;
}