aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_c_api.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_c_api.cpp')
-rw-r--r--test/unit/test_c_api.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index 0f1b906e..f274af57 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -1348,12 +1348,36 @@ TEST_F(CApi, proj_create_operations) {
EXPECT_EQ(proj_list_get(m_ctxt, res, -1), nullptr);
EXPECT_EQ(proj_list_get(m_ctxt, res, proj_list_get_count(res)), nullptr);
- auto op = proj_list_get(m_ctxt, res, 0);
- ASSERT_NE(op, nullptr);
- ObjectKeeper keeper_op(op);
- EXPECT_FALSE(proj_coordoperation_has_ballpark_transformation(m_ctxt, op));
+ {
+ auto op = proj_list_get(m_ctxt, res, 0);
+ ASSERT_NE(op, nullptr);
+ ObjectKeeper keeper_op(op);
+ EXPECT_FALSE(
+ proj_coordoperation_has_ballpark_transformation(m_ctxt, op));
+ EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (3)"));
+ }
+
+ {
+ PJ_COORD coord;
+ coord.xy.x = 40;
+ coord.xy.y = -100;
+ int idx = proj_get_suggested_operation(m_ctxt, res, PJ_FWD, coord);
+ ASSERT_GE(idx, 0);
+ ASSERT_LT(idx, proj_list_get_count(res));
+ auto op = proj_list_get(m_ctxt, res, idx);
+ ASSERT_NE(op, nullptr);
+ ObjectKeeper keeper_op(op);
+ // Transformation for USA
+ EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (1)"));
+ }
- EXPECT_EQ(proj_get_name(op), std::string("NAD27 to NAD83 (3)"));
+ {
+ PJ_COORD coord;
+ coord.xy.x = 40;
+ coord.xy.y = 10;
+ int idx = proj_get_suggested_operation(m_ctxt, res, PJ_FWD, coord);
+ EXPECT_GE(idx, -1);
+ }
}
// ---------------------------------------------------------------------------