-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCCopyConstructorTest.h
More file actions
100 lines (76 loc) · 2.18 KB
/
Copy pathCCopyConstructorTest.h
File metadata and controls
100 lines (76 loc) · 2.18 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
/*
* CCopyConstructorTest.h
*
* Created on: Jan 10, 2018
* Author: ANKIT
*/
#ifndef CCOPYCONSTRUCTORTEST_H_
#define CCOPYCONSTRUCTORTEST_H_
#include <cppunit/TestCaller.h>
#include <cppunit/TestSuite.h>
#include "../myCode/CRoute.h"
using namespace CppUnit;
class CCopyConstructorTest: public CppUnit::TestFixture{
private:
CWaypoint* wp1;
CWaypoint* wp2;
CWaypoint* wp3;
CPOI* poi1;
CPOI* poi2;
CPOI* poi3;
CPoiDatabase* PoiDatabase;
CWpDatabase* WpDatabase;
CRoute* r1;
public:
void setUp(){
/*
* creating the wp and poi for test scenario
* */
wp1 = new CWaypoint ("Frankfurt",52.52,13.40);
wp2 = new CWaypoint ("Hamburg",35.68,10.69);
wp3 = new CWaypoint ("DARMSTRADE",36.23,21.88);
poi1 = new CPOI (TOURISTIC,"EIFELTOWER","The tallest tower",10.45,20.65);
poi2 = new CPOI (UNIVERSITY,"HDA","Best Technical University",11.12,22.32);
poi3 = new CPOI (TRADEFAIR,"JOBFAIR","Trade fair in Darmstadt",24.88,22.31);
WpDatabase = new CWpDatabase;
WpDatabase->addWayPoint(*wp1);
WpDatabase->addWayPoint(*wp2);
WpDatabase->addWayPoint(*wp3);
PoiDatabase = new CPoiDatabase;
PoiDatabase->addPoi(*poi1);
PoiDatabase->addPoi(* poi2);
PoiDatabase->addPoi(* poi3);
r1 = new CRoute;
r1->connectToWpDatabase(WpDatabase);
r1->connectToPoiDatabase(PoiDatabase);
r1->addWaypoint("Frankfurt");
r1->addWaypoint("Hamburg");
r1->addWaypoint("DARMSTRADE");
r1->addPoi("EIFELTOWER","Frankfurt");
r1->addPoi("HDA","Hamburg");
r1->addPoi("JOBFAIR","DARMSTRADE");
}
/* Test for Copy Constructor*/
void CopyConstTesting(){
CRoute r2(*r1);
r2.print();
}
static CppUnit::TestSuite* suite_CopyConstructorTest() {
CppUnit::TestSuite* suite = new CppUnit::TestSuite("Load Tests:Copy Constructor Testing");
suite->addTest(new CppUnit::TestCaller<CCopyConstructorTest>
("Copy Constructor Testing", &CCopyConstructorTest::CopyConstTesting));
return suite;
}
void tearDown(){
delete wp1;
delete wp2;
delete wp3;
delete poi1;
delete poi2;
delete poi3;
delete PoiDatabase;
delete WpDatabase;
delete r1;
}
};
#endif /* CCOPYCONSTRUCTORTEST_H_ */