aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-18 13:13:47 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-09-18 13:13:47 +0200
commit527e1eb983955a82b87003d6c369c931a3ca0e36 (patch)
treea66543ba0e904341abbf0eed8165f5c940a4f21c /test/unit/test_io.cpp
parent438ead90d3502f1bf2cb6ed466e75661f33c9445 (diff)
downloadPROJ-527e1eb983955a82b87003d6c369c931a3ca0e36.tar.gz
PROJ-527e1eb983955a82b87003d6c369c931a3ca0e36.zip
Optimize pipelines of planetary CRS (geocentric latitude, west-positive longitude)
Diffstat (limited to 'test/unit/test_io.cpp')
-rw-r--r--test/unit/test_io.cpp59
1 files changed, 56 insertions, 3 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index ed059fe3..f9a54f3c 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -7852,6 +7852,56 @@ TEST(io, projstringformatter_axisswap_unitconvert_axisswap) {
// ---------------------------------------------------------------------------
+TEST(io, projstringformatter_axisswap_one_minus_two_inv) {
+ auto fmt = PROJStringFormatter::create();
+ fmt->ingestPROJString(
+ "+proj=pipeline +step +inv +proj=axisswap +order=1,-2");
+ EXPECT_EQ(fmt->toString(), "+proj=axisswap +order=1,-2");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(io, projstringformatter_axisswap_two_one_followed_two_minus_one) {
+ auto fmt = PROJStringFormatter::create();
+ fmt->ingestPROJString("+proj=pipeline "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=axisswap +order=2,-1");
+ EXPECT_EQ(fmt->toString(), "+proj=axisswap +order=1,-2");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(io, projstringformatter_axisswap_minus_two_one_followed_two_one) {
+ auto fmt = PROJStringFormatter::create();
+ fmt->ingestPROJString("+proj=pipeline "
+ "+step +proj=axisswap +order=-2,1 "
+ "+step +proj=axisswap +order=2,1");
+ EXPECT_EQ(fmt->toString(), "+proj=axisswap +order=1,-2");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(io, projstringformatter_unmodified) {
+ const char *const strs[] = {"+proj=pipeline "
+ "+step +proj=axisswap +order=2,-1 "
+ "+step +proj=axisswap +order=2,1",
+
+ "+proj=pipeline "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=axisswap +order=-2,1",
+
+ "+proj=pipeline "
+ "+step +inv +proj=axisswap +order=-2,1 "
+ "+step +proj=axisswap +order=2,1"};
+ for (const char *str : strs) {
+ auto fmt = PROJStringFormatter::create();
+ fmt->ingestPROJString(str);
+ EXPECT_EQ(fmt->toString(), str);
+ }
+}
+
+// ---------------------------------------------------------------------------
+
TEST(io, projstringformatter_optim_hgridshift_vgridshift_hgridshift_inv) {
// Nominal case
{
@@ -8786,9 +8836,12 @@ TEST(io, projparse_longlat_axisswap) {
op->exportToPROJString(PROJStringFormatter::create().get()),
(atoi(order1) == 2 && atoi(order2) == 1)
? "+proj=noop"
- : "+proj=pipeline +step +proj=axisswap +order=2,1 "
- "+step +proj=axisswap +order=" +
- std::string(order1) + "," + order2);
+ : (atoi(order1) == 2 && atoi(order2) == -1)
+ ? "+proj=axisswap +order=1,-2"
+ : "+proj=pipeline +step +proj=axisswap "
+ "+order=2,1 "
+ "+step +proj=axisswap +order=" +
+ std::string(order1) + "," + order2);
}
}
}