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

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Sep 15 07:29:02 PDT 2014


Author: strk
Date: 2014-09-15 07:29:02 -0700 (Mon, 15 Sep 2014)
New Revision: 4003

Modified:
   trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
Log:
Normalize result before comparing

Modified: trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-09-12 14:35:27 UTC (rev 4002)
+++ trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-09-15 14:29:02 UTC (rev 4003)
@@ -96,10 +96,7 @@
 
 	    GEOSGeom_destroy(geom2_);
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1); 
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out,"MULTILINESTRING EMPTY");
+	    ensure_equals_wkt(geom2_,"MULTILINESTRING EMPTY");
     }
 
     //More points:
@@ -114,10 +111,7 @@
 
 	    GEOSGeom_destroy(geom2_);
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1); 
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out, "MULTILINESTRING ((310.3571428571428 500, 353.515625 298.59375), (353.515625 298.59375, 306.875 231.9642857142857), (306.875 231.9642857142857, 110 175.7142857142857), (589.1666666666666 -10, 306.875 231.9642857142857), (353.515625 298.59375, 590 204))");
+	    ensure_equals_wkt(geom2_, "MULTILINESTRING ((310.3571428571428 500, 353.515625 298.59375), (353.515625 298.59375, 306.875 231.9642857142857), (306.875 231.9642857142857, 110 175.7142857142857), (589.1666666666666 -10, 306.875 231.9642857142857), (353.515625 298.59375, 590 204))");
     }
     //Larger number of points:
     template<>
@@ -131,10 +125,7 @@
 
 	    GEOSGeom_destroy(geom2_);
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1);
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_); 
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out, 
+	    ensure_equals_wkt(geom2_, 
 "MULTILINESTRING ((190 510, 213.9473684210526 342.3684210526316), (213.9473684210526 342.3684210526316, 195.625 296.5625), (195.625 296.5625, 0 329.1666666666667), (195.625 296.5625, 216 266), (216 266, 88.33333333333333 138.3333333333333), (88.33333333333333 138.3333333333333, 0 76.50000000000001), (213.9473684210526 342.3684210526316, 267 307), (267 307, 225 265), (225 265, 216 266), (245 245, 225 265), (267 307, 275.9160583941606 309.5474452554744), (275.9160583941606 309.5474452554744, 303.1666666666667 284), (303.1666666666667 284, 296.6666666666667 245), (296.6666666666667 245, 245 245), (245 245, 245 201), (245 201, 88.33333333333333 138.3333333333333), (245 201, 380 120), (380 120, 500 0), (343.7615384615385 510, 275.9160583941606 309.5474452554744), (296.6666666666667 245, 380 120), (500 334.9051724137931, 303.1666666666667 284))"
       );
     }
@@ -150,10 +141,7 @@
 
 	    GEOSGeom_destroy(geom2_);
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 1);
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_); 
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out,
+	    ensure_equals_wkt(geom2_,
 "MULTILINESTRING ((185 215, 187.9268292682927 235.4878048780488), (187.9268292682927 235.4878048780488, 290 252.5), (185 140, 185 215), (185 215, 80 215), (100.8333333333334 340, 187.9268292682927 235.4878048780488))"
       );
     }
@@ -168,10 +156,7 @@
 
 	    GEOSGeom_destroy(geom2_);
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 1);
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out,
+	    ensure_equals_wkt(geom2_,
 "MULTILINESTRING ((45 770, 45 263.6473684210526), (45 263.6473684210526, -310 146.559649122807), (45 263.6473684210526, 59.16911764705881 267.8235294117647), (59.16911764705881 267.8235294117647, 239.4350649350649 179.4350649350649), (239.4350649350649 179.4350649350649, 241.3415637860082 151.9814814814815), (241.3415637860082 151.9814814814815, -310 -153.376923076923), (266.2 770, 181.9432314410481 418.9301310043668), (181.9432314410481 418.9301310043668, 59.16911764705881 267.8235294117647), (181.9432314410481 418.9301310043668, 311.875 251.875), (311.875 251.875, 239.4350649350649 179.4350649350649), (241.3415637860082 151.9814814814815, 433.3333333333333 -280), (701 344.5238095238096, 311.875 251.875))"
 	    );
     }
@@ -181,11 +166,7 @@
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((123 245), (165 313), (240 310), (260 260), (180 210), (240 210))");
 	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1);
-
-	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
-	    std::string out(wkt_c);
-	    free(wkt_c);
-	    ensure_equals(out,
+	    ensure_equals_wkt(geom2_,
 "MULTILINESTRING ((-14 376.5882352941176, 172.3651328095773 261.4803591470258), (172.3651328095773 261.4803591470258, 56.63157894736844 73), (172.3651328095773 261.4803591470258, 200.6640625 265.6015625), (200.6640625 265.6015625, 201 265.4), (201 265.4, 210 251), (210 251, 210 73), (208.04 450, 200.6640625 265.6015625), (397 343.8, 201 265.4), (210 251, 397 176.2))"
 	    );
     }



More information about the geos-commits mailing list