This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
131 lines (98 loc) · 3.7 KB
/
test.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
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
#include "pch.h"
#include "../DS-assignment3/Header.h"
#include <gtest/gtest.h>
TEST(Graph, addNodetest) {
Graph g;
int** arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
g.makeGraphfromMatrix(arr);
string s1 = "Sialkot:";
g.addNode("Sialkot");
//g.printGraph();
ASSERT_EQ(0, s1.compare(g.printsingleLink("Sialkot")));
}
TEST(Graph, addEdgetest) {
Graph g;
int** arr;
arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
g.makeGraphfromMatrix(arr);
string s1 = "Karachi:Sukkur->Peshawar->";
g.addedge("Karachi", "Peshawar", 200);
ASSERT_EQ(0, s1.compare(g.printsingleLink("Karachi")));
}
TEST(Graph, deleteNodetest) {
Graph g;
int** arr;
arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
g.makeGraphfromMatrix(arr);
string s1 = "Multan:Jhang->DG Khan->Bahwalpur->";
g.deleteNode("Lahore");
ASSERT_EQ(0, s1.compare(g.printsingleLink("Multan")));
}
TEST(Graph, deleteEdgetest) {
Graph g;
int** arr;
arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
g.makeGraphfromMatrix(arr);
string s1 = "Quetta:";
g.deleteEdge("Quetta", "Khuzdar");
g.printGraph();
ASSERT_EQ(0, s1.compare(g.printsingleLink("Quetta")));
}
TEST(Graph, shorterstPathfromOnetoalltest) {
Graph* g;
int** arr;
arr = ReadFromFile();
shortestPathfromOnetoall(arr, "Lahore");
//Print all shortest Path from Lahore to all cities
//Evaluator will verify your output from terminal
ASSERT_EQ(0, 0);
}
TEST(Graph, secondshorterstPathfromOnetoalltest) {
Graph* g;
int** arr;
arr = ReadFromFile();
secondshortestPathfromOnetoall(arr, "Lahore");
//Print all shortest Path from Lahore to all cities
//Evaluator will verify your output from terminal
ASSERT_EQ(0, 0);
}
TEST(Graph, shorterstPathfromalltoonetest) {
Graph* g;
int** arr;
arr = ReadFromFile();
shortestPathfromalltoone(arr, "Lahore");
//Print all shortest Path from all cities to Lahore
//Evaluator will verify your output from terminal
ASSERT_EQ(0, 0);
}
TEST(Graph, secondshorterstPathfromalltoonetest) {
Graph* g;
int** arr;
arr = ReadFromFile();
secondshortestPathfromalltoone(arr, "Lahore");
//Print all shortest Path from all cities to Lahore
//Evaluator will verify your output from terminal
ASSERT_EQ(0, 0);
}
TEST(Graph, ShortestRoutefrompairtest) {
Graph* g;
int** arr;
arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
string s1 = "Mansehra->Murree->Islamabad->";
string s2 = ShortestRoutefrompair(arr, "Mansehra", "Islamabad");
ASSERT_EQ(0, s1.compare(s2));
}
TEST(Graph, secondShortestRoutefrompairtest) {
Graph* g;
int** arr;
arr = ReadFromFile();//this fuction returns edges and cities in 2d int array. Cities are mapped to int values
//declared arraycount and V global for ease
string s1 = "Lahore->Gujranwala->Dina->Rawat->Chakwal->Balkasar->Islamabad->Hasan Abdal->Mansehra->";
string s2 = secondShortestRoutefrompair(arr, "Lahore", "Mansehra");
ASSERT_EQ(0, s1.compare(s2));
}