-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.cpp
66 lines (53 loc) · 1.49 KB
/
tests.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
#include "helperfunctions.h"
#include <iostream>
#include <string>
#include <cmath>
#include <gtest/gtest.h>
using namespace std;
TEST(CommElevationAngleXYZ, RationalCheck) {
Helperfunctions h;
////=degrees(asin(abs(R4)/(sqrt(P4*P4+Q4*Q4+R4*R4))))
ASSERT_EQ(35, round(h.CommElevationAngleXYZ(1,2,3,4,5,6)));
}
TEST(CommDistanceXYZ, RationalCheck) {
Helperfunctions h;
ASSERT_EQ(5, round(h.CommDistanceXYZ(1,2,3,4,5,6)));
}
TEST(DistanceXY, RationalCheck) {
Helperfunctions h;
ASSERT_EQ(sqrt(8), h.DistanceXY(1,2,3,4));
}
TEST(ConnectedEstimation, GroundGround) {
Helperfunctions h;
ASSERT_TRUE(h.ConnectedEstimation(1,2,3,4,5,6));
ASSERT_TRUE(h.ConnectedEstimation(0,0,2,400,0,2));
ASSERT_FALSE(h.ConnectedEstimation(0,0,2,1000,0,2));
}
TEST(ConnectedEstimation, GroundEle) {
Helperfunctions h;
ASSERT_TRUE(h.ConnectedEstimation(0,0,2,2000,0,600));
ASSERT_FALSE(h.ConnectedEstimation(0,0,2,4000,0,600));
}
TEST(ConnectedEstimation, EleEle) {
Helperfunctions h;
ASSERT_TRUE(h.ConnectedEstimation(0,0,600,1000,1000,600));
ASSERT_TRUE(h.ConnectedEstimation(0,0,600,2999,0,600));
ASSERT_FALSE(h.ConnectedEstimation(0,0,600,4000,0,600));
}
TEST(Mean, PositiveNos) {
Helperfunctions h;
ASSERT_EQ(10, h.Mean(9,11));
ASSERT_EQ(10.5, h.Mean(10,11));
}
TEST(Mean, Zero) {
Helperfunctions h;
ASSERT_EQ(0, h.Mean(-2,2));
}
TEST(Mean, NegativeNos) {
Helperfunctions h;
ASSERT_EQ(-5, h.Mean(-10,0));
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}