diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-12 18:36:39 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-03-12 19:40:35 +0100 |
| commit | 35425763e70b70f7efc9a5c9616695369609553f (patch) | |
| tree | 57fb24d1983252490e8f01755c9fd3caf934643b /test/unit/test_c_api.cpp | |
| parent | ca3caf0e976e95a739963567057654cb8909bfb9 (diff) | |
| download | PROJ-35425763e70b70f7efc9a5c9616695369609553f.tar.gz PROJ-35425763e70b70f7efc9a5c9616695369609553f.zip | |
Add proj_get_units_from_database() (fixes #2004)
Diffstat (limited to 'test/unit/test_c_api.cpp')
| -rw-r--r-- | test/unit/test_c_api.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 0f1b906e..bcd14c0f 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3401,6 +3401,48 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { // --------------------------------------------------------------------------- +TEST_F(CApi, proj_get_units_from_database) { + { proj_unit_list_destroy(nullptr); } + + { + auto list = proj_get_units_from_database(nullptr, nullptr, nullptr, + true, nullptr); + ASSERT_NE(list, nullptr); + ASSERT_NE(list[0], nullptr); + ASSERT_NE(list[0]->auth_name, nullptr); + ASSERT_NE(list[0]->code, nullptr); + ASSERT_NE(list[0]->name, nullptr); + proj_unit_list_destroy(list); + } + + { + int result_count = 0; + auto list = proj_get_units_from_database(nullptr, "EPSG", "linear", + false, &result_count); + ASSERT_NE(list, nullptr); + EXPECT_GT(result_count, 1); + EXPECT_EQ(list[result_count], nullptr); + bool found9001 = false; + for (int i = 0; i < result_count; i++) { + EXPECT_EQ(std::string(list[i]->auth_name), "EPSG"); + if (std::string(list[i]->code) == "9001") { + EXPECT_EQ(std::string(list[i]->name), "metre"); + EXPECT_EQ(std::string(list[i]->category), "linear"); + EXPECT_EQ(list[i]->conv_factor, 1.0); + ASSERT_NE(list[i]->proj_short_name, nullptr); + EXPECT_EQ(std::string(list[i]->proj_short_name), "m"); + EXPECT_EQ(list[i]->deprecated, 0); + found9001 = true; + } + EXPECT_EQ(list[i]->deprecated, 0); + } + EXPECT_TRUE(found9001); + proj_unit_list_destroy(list); + } +} + +// --------------------------------------------------------------------------- + TEST_F(CApi, proj_normalize_for_visualization) { { |
