[geos-commits] r2149 - in trunk/tests/unit: . geom geom/prep

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Aug 11 18:48:32 EDT 2008


Author: mloskot
Date: 2008-08-11 18:48:32 -0400 (Mon, 11 Aug 2008)
New Revision: 2149

Added:
   trunk/tests/unit/geom/prep/
   trunk/tests/unit/geom/prep/.PreparedGeometryFactoryTest.cpp.swp
   trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp
Modified:
   trunk/tests/unit/Makefile.am
Log:
Added PreparedGeometryFactoryTest with first test cases included. FIXME: The test causes memory leak because we don't know how to destroy PreparedGeometry objects returned by the factory, discussing on the geos-devel list now.

Modified: trunk/tests/unit/Makefile.am
===================================================================
--- trunk/tests/unit/Makefile.am	2008-08-07 16:59:14 UTC (rev 2148)
+++ trunk/tests/unit/Makefile.am	2008-08-11 22:48:32 UTC (rev 2149)
@@ -39,6 +39,7 @@
 	geom/TriangleTest.cpp \
 	geom/Geometry/isRectangleTest.cpp \
 	geom/Geometry/coversTest.cpp \
+	geom/prep/PreparedGeometryFactoryTest.cpp \
 	index/quadtree/DoubleBitsTest.cpp \
 	io/WKBReaderTest.cpp \
 	io/ByteOrderValuesTest.cpp \

Added: trunk/tests/unit/geom/prep/.PreparedGeometryFactoryTest.cpp.swp
===================================================================
(Binary files differ)


Property changes on: trunk/tests/unit/geom/prep/.PreparedGeometryFactoryTest.cpp.swp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp
===================================================================
--- trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp	                        (rev 0)
+++ trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp	2008-08-11 22:48:32 UTC (rev 2149)
@@ -0,0 +1,100 @@
+// $Id$
+// 
+// Test Suite for geos::geom::prep::PreparedGeometryFactory class.
+
+// TUT
+#include <tut.h>
+// GEOS
+#include <geos/geom/Geometry.h>
+#include <geos/geom/GeometryFactory.h>
+#include <geos/geom/prep/PreparedGeometry.h>
+#include <geos/geom/prep/PreparedGeometryFactory.h>
+#include <geos/io/WKTReader.h>
+#include <geos/util/IllegalArgumentException.h>
+// STL
+#include <vector>
+#include <cstring> // std::size_t
+
+using namespace geos::geom;
+
+namespace tut
+{
+	//
+	// Test Group
+	//
+
+	// Common data used by tests
+	struct test_preparedgeometryfactory_data
+	{
+    };
+
+	typedef test_group<test_preparedgeometryfactory_data> group;
+	typedef group::object object;
+
+	group test_preparedgeometryfactory_data("geos::geom::prep::PreparedGeometryFactory");
+
+	//
+	// Test Cases
+	//
+
+	// Test of default constructor
+	template<>
+	template<>
+	void object::test<1>()
+	{
+		prep::PreparedGeometryFactory pgf;
+	}
+	
+    // Test passing null-pointer to prepare static method
+	template<>
+	template<>
+	void object::test<2>()
+	{
+        // FIXME: null pointer throws segfault (Ticket #197)
+        // ensure(0 == prep::PreparedGeometryFactory::prepare(0));
+	}
+	
+    // Test passing null-pointer to create method
+	template<>
+	template<>
+	void object::test<3>()
+	{
+		prep::PreparedGeometryFactory pgf;
+
+        // FIXME: null pointer throws segfault (Ticket #197)
+        // ensure(0 == pgf.create(0));
+	}
+	
+    // Test prepare with empty POINT
+	template<>
+	template<>
+	void object::test<4>()
+	{
+		GeometryFactory gf;
+		Geometry* g = gf.createEmptyGeometry();
+		ensure( 0 != g );
+		
+        prep::PreparedGeometry const* pg = prep::PreparedGeometryFactory::prepare(g);
+		ensure( 0 != pg );
+
+        // FIXME: pg leaks here, but we don't know how to destroy
+	}
+	
+    // Test create with empty POINT
+	template<>
+	template<>
+	void object::test<5>()
+	{
+		GeometryFactory gf;
+		Geometry* g = gf.createEmptyGeometry();
+		ensure( 0 != g );
+		
+		prep::PreparedGeometryFactory pgf;
+		prep::PreparedGeometry const* pg = pgf.create(g);
+		ensure( 0 != pg );
+        // FIXME: pg leaks here, but we don't know how to destroy
+	}
+	
+
+} // namespace tut
+



More information about the geos-commits mailing list