aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-11-29 12:35:49 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-11-29 12:35:49 +0100
commit7b3ab527074e301bc81cedee7b8111c633ecf306 (patch)
tree5031a7052c07d6b620327a0a3b5c0caf87a67fc4 /test/unit
parentcf855b24d2b901054bee90309cdc5df00dfb3085 (diff)
downloadPROJ-7b3ab527074e301bc81cedee7b8111c633ecf306.tar.gz
PROJ-7b3ab527074e301bc81cedee7b8111c633ecf306.zip
proj_create_crs_to_crs(): rename arguments, update doc, and add a few test cases
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/gie_self_tests.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
index 7aca3001..b7af926b 100644
--- a/test/unit/gie_self_tests.cpp
+++ b/test/unit/gie_self_tests.cpp
@@ -275,6 +275,50 @@ TEST_F(gieTest, proj_create_crs_to_crs) {
// ---------------------------------------------------------------------------
+TEST_F(gieTest, proj_create_crs_to_crs_EPSG_4326) {
+
+ auto P =
+ proj_create_crs_to_crs(PJ_DEFAULT_CTX, "EPSG:4326", "EPSG:32631", NULL);
+ ASSERT_TRUE(P != nullptr);
+ PJ_COORD a, b;
+
+ // Lat, long degrees
+ a.xy.x = 0.0;
+ a.xy.y = 3.0;
+
+ b.xy.x = 500000.0;
+ b.xy.y = 0.0;
+
+ a = proj_trans(P, PJ_FWD, a);
+ EXPECT_NEAR(a.xy.x, b.xy.x, 1e-9);
+ EXPECT_NEAR(a.xy.y, b.xy.y, 1e-9);
+ proj_destroy(P);
+}
+
+// ---------------------------------------------------------------------------
+
+TEST_F(gieTest, proj_create_crs_to_crs_proj_longlat) {
+
+ auto P = proj_create_crs_to_crs(
+ PJ_DEFAULT_CTX, "+proj=longlat +datum=WGS84", "EPSG:32631", NULL);
+ ASSERT_TRUE(P != nullptr);
+ PJ_COORD a, b;
+
+ // Long, lat degrees
+ a.xy.x = 3.0;
+ a.xy.y = 0;
+
+ b.xy.x = 500000.0;
+ b.xy.y = 0.0;
+
+ a = proj_trans(P, PJ_FWD, a);
+ EXPECT_NEAR(a.xy.x, b.xy.x, 1e-9);
+ EXPECT_NEAR(a.xy.y, b.xy.y, 1e-9);
+ proj_destroy(P);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(gie, info_functions) {
PJ_INFO info;
PJ_PROJ_INFO pj_info;