-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
61 lines (52 loc) · 971 Bytes
/
main.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
/**
* @file: main.cpp
*/
#include "Graph/predecls.h"
#include "Deriv.h"
#include "Layout/Layout.h"
#include "Gui/mainscene.h"
/**
* Create a graph and call some of its methods.
*/
void Test_Graph()
{
printf("\nBase graph test started..\n");
Graph g;
int num = 10;
pNode *p = new pNode[num];
for(int i = 0; i < num; i++) {
p[i] = g.AddNode();
}
for(int i = 0; i < num-1; i++) {
g.AddEdge(p[i], p[i+1]);
}
for(int i = 2; i < num; i+=3) {
g.AddEdge(p[i], p[i-2]);
}
g.Dump();
g.DeleteNode(p[5]);
g.DeleteNode(p[7]);
g.DeleteEdge(p[3],p[4]);
g.AddEdge(p[3], p[6]);
g.Dump();
g.Destroy();
delete []p;
printf("Base graph test passed!\n");
}
void Run_Unit_Tests()
{
// Test base graph
Test_Graph();
// Test derived graph
Derivation_Example();
//Layout tests
LayoutTest();
}
/**
* Main function
*/
int main(int argc, char **argv)
{
Run_Unit_Tests();
return 0;
}