-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCWpAdditionTest.h
More file actions
80 lines (55 loc) · 1.53 KB
/
Copy pathCWpAdditionTest.h
File metadata and controls
80 lines (55 loc) · 1.53 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
/*
* CWpAdditionTest.h
*
* Created on: Jan 10, 2018
* Author: ANKIT
*/
#ifndef CWPADDITIONTEST_H_
#define CWPADDITIONTEST_H_
#include <cppunit/TestCaller.h>
#include <cppunit/TestSuite.h>
#include "../myCode/CRoute.h"
using namespace CppUnit;
class CWpAdditionTest: public CppUnit::TestFixture{
private:
CWaypoint* wp1;
CWaypoint* wp2;
CWpDatabase* WpDatabase;
CRoute* r;
public:
void setUp(){
/*
* creating the wp for test scenario
* */
wp1 = new CWaypoint ("Frankfurt",52.52,13.40);
wp2 = new CWaypoint ("Hamburg",35.68,10.69);
WpDatabase = new CWpDatabase;
WpDatabase->addWayPoint(*wp1);
WpDatabase->addWayPoint(*wp2);
r = new CRoute;
r->connectToWpDatabase(WpDatabase);
}
void WpAddition_WithoutWp(){
r->addWaypoint("India");
CPPUNIT_ASSERT_EQUAL(0,(int)r->getRoute().size());
}
void WpAddition_WithWp(){
r->addWaypoint("Frankfurt");
CPPUNIT_ASSERT_EQUAL(1,(int)r->getRoute().size());
}
static CppUnit::TestSuite* suite_WpAdditionTest() {
CppUnit::TestSuite* suite = new CppUnit::TestSuite("Load Tests:WpAddition Test");
suite->addTest(new CppUnit::TestCaller<CWpAdditionTest>
("Add wp without existing wp", &CWpAdditionTest::WpAddition_WithoutWp));
suite->addTest(new CppUnit::TestCaller<CWpAdditionTest>
("Add wp with existing wp", &CWpAdditionTest::WpAddition_WithWp));
return suite;
}
void tearDown(){
delete wp1;
delete wp2;
delete WpDatabase;
delete r;
}
};
#endif /* CWPADDITIONTEST_H_ */