Changeset: 6352aa9759c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6352aa9759c9
Added Files:
        testing/floatutil.py
Modified Files:
        geom/sql/functions/Tests/ST_Transform-3.12.test
        testing/CMakeLists.txt
Branch: default
Log Message:

Round floating point numbers inside GEOM output.


diffs (43 lines):

diff --git a/geom/sql/functions/Tests/ST_Transform-3.12.test 
b/geom/sql/functions/Tests/ST_Transform-3.12.test
--- a/geom/sql/functions/Tests/ST_Transform-3.12.test
+++ b/geom/sql/functions/Tests/ST_Transform-3.12.test
@@ -11,10 +11,10 @@ SELECT ST_AsText(ST_Transform(st_setsrid
 POINT (3256910.236847341 2912495.4152792906)
 
 # MultiPoint from 4326 to 3035
-query T rowsort
+query T python .floatutil.filter
 SELECT ST_AsText(ST_Transform(st_setsrid(st_geomfromtext('MULTIPOINT 
(-4.4657183 48.38249, -4.4965715 48.38242, -4.644325 48.092247, -4.4851084 
48.38132, -4.4954414 48.38366, -4.347825 48.117958, -4.7691517 47.987152, 
-4.4719133 48.16634, -4.782632 48.005634, -4.46572 48.382507)'), 4326), 3035))
 ----
-MULTIPOINT ((3256910.236847341 2912495.4152792906), (3254672.9232832035 
2912934.464415785), (3237755.624311555 2883346.764096317), (3255480.2556084394 
2912648.0202165362), (3254781.139009903 2913053.7668744745), (3259904.442835956 
2881843.1157471547), (3226399.412122161 2873698.5144423316), 
(3251885.3356214464 2888932.855248591), (3225814.1034443 2875919.873412735), 
(3256910.4738176083 2912497.300134165))
+MULTIPOINT ((3256910.237 2912495.415), (3254672.923 2912934.464), (3237755.624 
2883346.764), (3255480.256 2912648.020), (3254781.139 2913053.767), 
(3259904.443 2881843.116), (3226399.412 2873698.514), (3251885.336 
2888932.855), (3225814.103 2875919.873), (3256910.474 2912497.300))
 
 # Linestring from 4326 to 3035
 query T rowsort
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -143,6 +143,7 @@ if(PYTHON3_LIBDIR)
     sqllogictest.py
     explain.py
     plan.py
+    floatutil.py
     mapicursor.py
     malmapi.py
     helpers.py
diff --git a/testing/floatutil.py b/testing/floatutil.py
new file mode 100644
--- /dev/null
+++ b/testing/floatutil.py
@@ -0,0 +1,11 @@
+from decimal import Decimal
+from re import sub
+
+def do_round(res):
+    return str(round(Decimal(res.group(0)), 3))
+
+def filter(tab):
+    res = []
+    for row in tab:
+        res.append([sub(r'\b([0-9]+\.[0-9]{4,})\b', do_round, row[0])])
+    return sorted(res)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to