Skip to content

Commit f40e05d

Browse files
committed
Added tests for functions in SphericalUtil class
1 parent 396faa4 commit f40e05d

14 files changed

+88
-51
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Gtests
2+
Sample
3+
14
## Ignore Visual Studio temporary files, build results, and
25
## files generated by popular Visual Studio add-ons.
36

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sample :
2+
g++ samples/Samples.cpp \
3+
-std=c++14 -Iinclude/ \
4+
-o Sample
5+
6+
gtests :
7+
g++ tests/Tests.cpp \
8+
-std=c++14 -Iinclude/ \
9+
-lgtest -pthread \
10+
-o GTests

tests/SphericalUtil/computeOffset.cpp renamed to tests/SphericalUtil/computeOffset.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
#include "SphericalUtil.hpp"
44

5-
inline void EXPECT_NEAR_LatLan(LatLng actual, LatLng expected) {
6-
EXPECT_NEAR(actual.lat, expected.lat, 1e-6);
5+
#define EXPECT_NEAR_LatLan(actual, expected) \
6+
EXPECT_NEAR(actual.lat, expected.lat, 1e-6);
77
// Issue #2
88
// Account for the convergence of longitude lines at the poles
99
// double cosLat = cos(deg2rad(actual.lat));
1010
// EXPECT_NEAR(cosLat * actual.lng, cosLat * expected.lng, 1e-6);
11-
}
1211

1312
TEST(SphericalUtil, computeOffset) {
1413
LatLng up = { 90.0, 0.0 };

tests/SphericalUtil/computeOffsetOrigin.cpp renamed to tests/SphericalUtil/computeOffsetOrigin.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
#include "SphericalUtil.hpp"
44

55

6-
inline void EXPECT_NEAR_LatLan(LatLng actual, LatLng expected) {
7-
EXPECT_NEAR(actual.lat, expected.lat, 1e-6);
6+
#define EXPECT_NEAR_LatLan(actual, expected) \
7+
EXPECT_NEAR(actual.lat, expected.lat, 1e-6);
88
// Issue #2
9-
// Account for the convergence of longitude lines at the poles
9+
// Account for the convergence of longitude lines at the poles
1010
// double cosLat = cos(deg2rad(actual.lat));
11-
// EXPECT_NEAR(cosLat * actual.lng, cosLat * expected.lng, 1e-6);
12-
}
11+
// EXPECT_NEAR(cosLat * actual.lng, cosLat * expected.lng, 1e-6);
1312

1413
TEST(SphericalUtil, computeOffsetOrigin) {
1514
LatLng front = { 0.0, 0.0 };

0 commit comments

Comments
 (0)