[geos-commits] r4008 - trunk/tests/unit/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Sep 16 08:37:49 PDT 2014


Author: strk
Date: 2014-09-16 08:37:49 -0700 (Tue, 16 Sep 2014)
New Revision: 4008

Modified:
   trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
Log:
Add some tolerance to VoronoiDiagram tester

Modified: trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-09-16 15:00:44 UTC (rev 4007)
+++ trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-09-16 15:37:49 UTC (rev 4008)
@@ -45,21 +45,23 @@
 
         void ensure_equals_wkt(GEOSGeometry* g, const char* exp)
         {
+          GEOSGeometry* exp_g = GEOSGeomFromWKT(exp);
+
           GEOSNormalize(g);
-          char* wkt_c = GEOSWKTWriter_write(w_, g);
-          std::string out(wkt_c);
-          free(wkt_c);
+          GEOSNormalize(exp_g);
+          bool eq = GEOSEqualsExact(g, exp_g, 1e-10);
+          if ( ! eq ) {
+            using namespace std;
+            char *wkt_exp = GEOSWKTWriter_write(w_, exp_g);
+            char *wkt_obt = GEOSWKTWriter_write(w_, g);
+            cout << "Expected: " << wkt_exp << endl;
+            cout << "Obtained: " << wkt_obt << endl;
+            free(wkt_exp);
+            free(wkt_obt);
+          }
 
-	  GEOSGeometry* exp_g = GEOSGeomFromWKT(exp);
-	  GEOSNormalize(exp_g);
-	  char* wkt_c2 = GEOSWKTWriter_write(w_, exp_g); 
-	  std::string out_exp(wkt_c2);
-	  free(wkt_c2);
-
-//	  cout << "OUTPUT STRING::" << out << endl << endl;
-//	  cout << "Expected STRING::" << out_exp << endl << endl;
-          ensure_equals(out, out_exp);
-	  GEOSGeom_destroy(exp_g);
+          ensure(eq);
+          GEOSGeom_destroy(exp_g);
         }
 
         ~test_capigeosvoronoidiagram_data()



More information about the geos-commits mailing list