[geos-commits] r2165 - trunk/tests/unit/algorithm/CGAlgorithms

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Aug 18 19:45:39 EDT 2008


Author: mloskot
Date: 2008-08-18 19:45:34 -0400 (Mon, 18 Aug 2008)
New Revision: 2165

Modified:
   trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
Log:
tests/unit/algorithm/CGAlgorithms: Fixed number of memory leaks.

Modified: trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp	2008-08-18 23:30:00 UTC (rev 2164)
+++ trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp	2008-08-18 23:45:34 UTC (rev 2165)
@@ -8,12 +8,14 @@
 // geos
 #include <geos/algorithm/CGAlgorithms.h>
 #include <geos/geom/Polygon.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/CoordinateSequence.h>
 #include <geos/geom/Coordinate.h>
-#include <geos/geom/Geometry.h>
 #include <geos/io/WKTReader.h>
 // std
 #include <string>
 #include <memory>
+#include <cassert>
 
 using namespace geos::algorithm;
 
@@ -27,9 +29,20 @@
     {
 	    typedef std::auto_ptr<geos::geom::Geometry> GeometryPtr;
 
+        geos::geom::CoordinateSequence* cs_;
         geos::io::WKTReader reader_;
 
-        test_isccw_data() {}
+        test_isccw_data()
+            : cs_(0)
+        {
+            assert(0 == cs_);
+        }
+        
+        ~test_isccw_data()
+        {
+            delete cs_;
+            cs_ = 0;
+        }
     };
 
     typedef test_group<test_isccw_data> group;
@@ -49,7 +62,8 @@
         const std::string wkt("POLYGON ((60 180, 140 240, 140 240, 140 240, 200 180, 120 120, 60 180))");
 		GeometryPtr geom(reader_.read(wkt));
 
-        bool isCCW = CGAlgorithms::isCCW(geom->getCoordinates());
+        cs_ = geom->getCoordinates();
+        bool isCCW = CGAlgorithms::isCCW(cs_);
 
         ensure_equals( false, isCCW );
     }
@@ -62,7 +76,8 @@
         const std::string wkt("POLYGON ((60 180, 140 120, 100 180, 140 240, 60 180))");
 		GeometryPtr geom(reader_.read(wkt));
 
-        bool isCCW = CGAlgorithms::isCCW(geom->getCoordinates());
+        cs_ = geom->getCoordinates();
+        bool isCCW = CGAlgorithms::isCCW(cs_);
 
         ensure_equals( true, isCCW );
     }
@@ -75,9 +90,11 @@
         const std::string wkt("POLYGON ((60 180, 140 120, 100 180, 140 240, 140 240, 60 180))");
 		GeometryPtr geom(reader_.read(wkt));
 
-        bool isCCW = CGAlgorithms::isCCW(geom->getCoordinates());
+        cs_ = geom->getCoordinates();
+        bool isCCW = CGAlgorithms::isCCW(cs_);
 
         ensure_equals( true, isCCW );
     }
 
 } // namespace tut
+



More information about the geos-commits mailing list