-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
135 lines (112 loc) · 5.08 KB
/
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
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
/*
* main.cpp
*
* Created on: 15 nov. 2013
* Author: MOULIN
*/
#include "view/requestinterface.h"
#include "graph_view/graph_generate.h"
#include <QApplication>
#include <QtGui>
#include <iostream>
#include "model/component/router.h"
#include "tests/testsBuilding.h"
#include "tests/testsComponent.h"
#include "tests/testsFirewall.h"
#include "tests/testsFloor.h"
#include "tests/testsLocation.h"
#include "tests/tests_building_building.h"
#include "tests/testsRequest.h"
using namespace std;
//mockup
#include "model/request.h"
#include <vector>
#include "model/location/building.h"
#include "model/location/building_building.h"
#include "model/constant.h"
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//Testing Classes init
TestsBuilding testsBuilding;
TestsComponent testsComponent;
TestsFirewall testsFirewall;
TestsFloor testsFloor;
TestsLocation testsLocation;
Tests_building_building tests_building_building;
TestsRequest testsRequest;
unsigned int testNumber = 14, testsPassed = 0;
//Test of Location Class
bool resultTestLocationComponent = testsLocation.testComponent() ;
cout << "\nTest of Component management by a Location : " << Constant::boolToString(resultTestLocationComponent) << endl;
bool resultTestLocationUserNumber = testsLocation.testGetUserNumber() ;
cout << "Test of user number management in a Location : " << Constant::boolToString(resultTestLocationUserNumber) << endl;
//Test of Building Class
bool resultTestBuildingFloors = testsBuilding.testGetFloors();
cout << "Test of floor(s) management by a Building : " << Constant::boolToString(resultTestBuildingFloors) << endl;
bool resultTestBuildingAdmin = testsBuilding.testIsAdmin();
cout << "Test of Admin\'status management by a Building : " << Constant::boolToString(resultTestBuildingAdmin) << endl;
//Test of Floor Class
bool resultTestFloorNumber = testsFloor.testFloorNumber();
cout << "Test of Floor\'s number management by a Floor : " << Constant::boolToString(resultTestFloorNumber) << endl;
//Test of Component Class
bool resultTestComponentAddress = testsComponent.testAddress();
cout << "Test of Address management by a Component : " << Constant::boolToString(resultTestComponentAddress) << endl;
//Test of Firewall Class
bool resultTestFirewallAddresses = testsFirewall.testAddresses();
cout << "Test of multiple address management by a Firewall : " << Constant::boolToString(resultTestFirewallAddresses) << endl;
bool resultTestFirewallRules = testsFirewall.testRules();
cout << "Test of rules management by a Firewall : " << Constant::boolToString(resultTestFirewallRules) << endl;
//Test of Building_building Class
bool resultTestB2BDistance = tests_building_building.testDistance();
cout << "Test of distance management by a Building_building : " << Constant::boolToString(resultTestB2BDistance) << endl;
bool resultTestB2BVisibility = tests_building_building.testVisibility();
cout << "Test of visibility management by a Building_building : " << Constant::boolToString(resultTestB2BVisibility) << endl;
bool resultTestB2BExistingTechs = tests_building_building.testExistingTechs();
cout << "Test of existing techs management by a Building_building : " << Constant::boolToString(resultTestB2BExistingTechs) << endl;
//Test of Request Class
bool resultTestRequestBuilding = testsRequest.testBuilding();
cout << "Test of Building management by a Request : " << Constant::boolToString(resultTestRequestBuilding) << endl;
bool resultTestRequestB2B = testsRequest.testB2B();
cout << "Test of building_building management by a Request : " << Constant::boolToString(resultTestRequestB2B) << endl;
bool resultTestRequestCheckData = testsRequest.testCheckData();
cout << "Test of data checking by a Request : " << Constant::boolToString(resultTestRequestCheckData) << endl;
//Statistics for testing
if(resultTestB2BDistance)
testsPassed++;
if(resultTestB2BExistingTechs)
testsPassed++;
if(resultTestB2BVisibility)
testsPassed++;
if(resultTestBuildingAdmin)
testsPassed++;
if(resultTestBuildingFloors)
testsPassed++;
if(resultTestComponentAddress)
testsPassed++;
if(resultTestFirewallAddresses)
testsPassed++;
if(resultTestFirewallRules)
testsPassed++;
if(resultTestFloorNumber)
testsPassed++;
if(resultTestLocationComponent)
testsPassed++;
if(resultTestLocationUserNumber)
testsPassed++;
if(resultTestRequestB2B)
testsPassed++;
if(resultTestRequestBuilding)
testsPassed++;
if(resultTestRequestCheckData)
testsPassed++;
unsigned int testsFailed = testNumber - testsPassed;
float statTesting = ((float)testsPassed / (float)testNumber) * 100;
cout << "\n Statistics : "<< testsPassed << " passed, " << testsFailed << " failed - ";
printf("%.2f", statTesting);
cout << "% of success" << endl;
RequestInterface window ;
window.show();
return app.exec();
}