[geos-commits] r2156 - in trunk/tests/unit: algorithm
algorithm/CGAlgorithms geom/prep operation
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Aug 11 20:23:44 EDT 2008
Author: mloskot
Date: 2008-08-11 20:23:44 -0400 (Mon, 11 Aug 2008)
New Revision: 2156
Modified:
trunk/tests/unit/algorithm/CGAlgorithms/computeOrientationTest.cpp
trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
trunk/tests/unit/algorithm/ConvexHullTest.cpp
trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp
trunk/tests/unit/operation/IsSimpleOpTest.cpp
Log:
Fixed EOL to LF in trunk/tests.
Modified: trunk/tests/unit/algorithm/CGAlgorithms/computeOrientationTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/CGAlgorithms/computeOrientationTest.cpp 2008-08-12 00:09:34 UTC (rev 2155)
+++ trunk/tests/unit/algorithm/CGAlgorithms/computeOrientationTest.cpp 2008-08-12 00:23:44 UTC (rev 2156)
@@ -1,85 +1,85 @@
-// $Id$
-//
-// Test Suite for CGAlgorithms::computeOrientation() function
-// Ported from JTS junit/algorithm/ComputeOrientationTest.java
-
-// tut
-#include <tut.h>
-// geos
-#include <geos/algorithm/CGAlgorithms.h>
-#include <geos/geom/Coordinate.h>
-#include <geos/geom/CoordinateSequence.h>
-#include <geos/geom/CoordinateArraySequence.h>
-#include <geos/geom/Geometry.h>
-#include <geos/geom/Polygon.h>
-#include <geos/io/WKTReader.h>
-// std
-#include <string>
-#include <memory>
-
-using namespace geos::geom;
-using namespace geos::algorithm;
-
-namespace tut
-{
- //
- // Test Group
- //
-
- struct test_computeorientation_data
- {
- geos::io::WKTReader reader_;
-
- test_computeorientation_data() {}
- };
-
- typedef test_group<test_computeorientation_data> group;
- typedef group::object object;
-
- group test_computeorientation_group("geos::algorithm::CGAlgorithms::computeOrientation");
-
- //
- // Test Cases
- //
-
- // 1 - Test CCW orientation
- template<>
- template<>
- void object::test<1>()
- {
- const std::string wkt("LINESTRING ( 0 0, 0 1, 1 1)");
- Geometry::AutoPtr geom(reader_.read(wkt));
-
- CoordinateSequence::AutoPtr pts(geom->getCoordinates());
-
- int const a = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
- int const b = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
- int const c = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
-
- ensure_equals( a, b );
- ensure_equals( a, c );
- }
-
- // 2 - Test CCW orientation
- template<>
- template<>
- void object::test<2>()
- {
- Coordinate c1(1.0000000000004998, -7.989685402102996);
- Coordinate c2(10.0, -7.004368924503866);
- Coordinate c3(1.0000000000005, -7.989685402102996);
-
- CoordinateArraySequence pts;
- pts.add(c1);
- pts.add(c2);
- pts.add(c3);
-
- int const a = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
- int const b = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
- int const c = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
-
- ensure_equals( a, b );
- ensure_equals( a, c );
- }
-
-} // namespace tut
+// $Id$
+//
+// Test Suite for CGAlgorithms::computeOrientation() function
+// Ported from JTS junit/algorithm/ComputeOrientationTest.java
+
+// tut
+#include <tut.h>
+// geos
+#include <geos/algorithm/CGAlgorithms.h>
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/CoordinateSequence.h>
+#include <geos/geom/CoordinateArraySequence.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/Polygon.h>
+#include <geos/io/WKTReader.h>
+// std
+#include <string>
+#include <memory>
+
+using namespace geos::geom;
+using namespace geos::algorithm;
+
+namespace tut
+{
+ //
+ // Test Group
+ //
+
+ struct test_computeorientation_data
+ {
+ geos::io::WKTReader reader_;
+
+ test_computeorientation_data() {}
+ };
+
+ typedef test_group<test_computeorientation_data> group;
+ typedef group::object object;
+
+ group test_computeorientation_group("geos::algorithm::CGAlgorithms::computeOrientation");
+
+ //
+ // Test Cases
+ //
+
+ // 1 - Test CCW orientation
+ template<>
+ template<>
+ void object::test<1>()
+ {
+ const std::string wkt("LINESTRING ( 0 0, 0 1, 1 1)");
+ Geometry::AutoPtr geom(reader_.read(wkt));
+
+ CoordinateSequence::AutoPtr pts(geom->getCoordinates());
+
+ int const a = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
+ int const b = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
+ int const c = CGAlgorithms::computeOrientation(pts->getAt(0), pts->getAt(1), pts->getAt(2));
+
+ ensure_equals( a, b );
+ ensure_equals( a, c );
+ }
+
+ // 2 - Test CCW orientation
+ template<>
+ template<>
+ void object::test<2>()
+ {
+ Coordinate c1(1.0000000000004998, -7.989685402102996);
+ Coordinate c2(10.0, -7.004368924503866);
+ Coordinate c3(1.0000000000005, -7.989685402102996);
+
+ CoordinateArraySequence pts;
+ pts.add(c1);
+ pts.add(c2);
+ pts.add(c3);
+
+ int const a = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
+ int const b = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
+ int const c = CGAlgorithms::computeOrientation(pts[0], pts[1], pts[2]);
+
+ ensure_equals( a, b );
+ ensure_equals( a, c );
+ }
+
+} // namespace tut
Modified: trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp 2008-08-12 00:09:34 UTC (rev 2155)
+++ trunk/tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp 2008-08-12 00:23:44 UTC (rev 2156)
@@ -1,83 +1,83 @@
-// $Id$
-//
-// Test Suite for CGAlgorithms::isCCW() function
-// Ported from JTS junit/algorithm/IsCCWTest.java
-
-// tut
-#include <tut.h>
-// geos
-#include <geos/algorithm/CGAlgorithms.h>
-#include <geos/geom/Polygon.h>
-#include <geos/geom/Coordinate.h>
-#include <geos/geom/Geometry.h>
-#include <geos/io/WKTReader.h>
-// std
-#include <string>
-#include <memory>
-
-using namespace geos::algorithm;
-
-namespace tut
-{
- //
- // Test Group
- //
-
- struct test_isccw_data
- {
- typedef std::auto_ptr<geos::geom::Geometry> GeometryPtr;
-
- geos::io::WKTReader reader_;
-
- test_isccw_data() {}
- };
-
- typedef test_group<test_isccw_data> group;
- typedef group::object object;
-
- group test_isccw_group("geos::algorithm::CGAlgorithms::isCCW");
-
- //
- // Test Cases
- //
-
- // 1 - Test if coordinates of polygon are counter-clockwise oriented
- template<>
- template<>
- void object::test<1>()
- {
- 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());
-
- ensure_equals( false, isCCW );
- }
-
- // 2 - Test if coordinates of polygon are counter-clockwise oriented
- template<>
- template<>
- void object::test<2>()
- {
- 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());
-
- ensure_equals( true, isCCW );
- }
-
- // 3 - Test the same polygon as in test No 2 but with duplicated top point
- template<>
- template<>
- void object::test<3>()
- {
- 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());
-
- ensure_equals( true, isCCW );
- }
-
-} // namespace tut
+// $Id$
+//
+// Test Suite for CGAlgorithms::isCCW() function
+// Ported from JTS junit/algorithm/IsCCWTest.java
+
+// tut
+#include <tut.h>
+// geos
+#include <geos/algorithm/CGAlgorithms.h>
+#include <geos/geom/Polygon.h>
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/Geometry.h>
+#include <geos/io/WKTReader.h>
+// std
+#include <string>
+#include <memory>
+
+using namespace geos::algorithm;
+
+namespace tut
+{
+ //
+ // Test Group
+ //
+
+ struct test_isccw_data
+ {
+ typedef std::auto_ptr<geos::geom::Geometry> GeometryPtr;
+
+ geos::io::WKTReader reader_;
+
+ test_isccw_data() {}
+ };
+
+ typedef test_group<test_isccw_data> group;
+ typedef group::object object;
+
+ group test_isccw_group("geos::algorithm::CGAlgorithms::isCCW");
+
+ //
+ // Test Cases
+ //
+
+ // 1 - Test if coordinates of polygon are counter-clockwise oriented
+ template<>
+ template<>
+ void object::test<1>()
+ {
+ 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());
+
+ ensure_equals( false, isCCW );
+ }
+
+ // 2 - Test if coordinates of polygon are counter-clockwise oriented
+ template<>
+ template<>
+ void object::test<2>()
+ {
+ 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());
+
+ ensure_equals( true, isCCW );
+ }
+
+ // 3 - Test the same polygon as in test No 2 but with duplicated top point
+ template<>
+ template<>
+ void object::test<3>()
+ {
+ 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());
+
+ ensure_equals( true, isCCW );
+ }
+
+} // namespace tut
Modified: trunk/tests/unit/algorithm/ConvexHullTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/ConvexHullTest.cpp 2008-08-12 00:09:34 UTC (rev 2155)
+++ trunk/tests/unit/algorithm/ConvexHullTest.cpp 2008-08-12 00:23:44 UTC (rev 2156)
@@ -1,191 +1,191 @@
-// $Id$
-//
-// Test Suite for geos::algorithm::ConvexHull
-// Ported from JTS junit/algorithm/ConvexHullTest.java
-
-// tut
-#include <tut.h>
-#include <utility.h>
-// geos
-#include <geos/algorithm/ConvexHull.h>
-#include <geos/geom/LineString.h>
-#include <geos/geom/Coordinate.h>
-#include <geos/geom/CoordinateArraySequence.h>
-#include <geos/geom/Dimension.h>
-#include <geos/geom/Geometry.h>
-#include <geos/geom/GeometryFactory.h>
-#include <geos/geom/PrecisionModel.h>
-#include <geos/io/WKTReader.h>
-// std
-#include <sstream>
-#include <memory>
-
-namespace geos {
- namespace geom {
- class Geometry;
- }
-}
-
-using namespace geos::geom; // for Location
-
-namespace tut
-{
- //
- // Test Group
- //
-
- // dummy data, not used
- struct test_convexhull_data
- {
- // Typedefs used as short names by test cases
- typedef std::auto_ptr<geos::geom::Geometry> GeometryAPtr;
- typedef std::auto_ptr<geos::geom::LineString> LineStringAPtr;
-
- geos::geom::PrecisionModel pm_;
- geos::geom::GeometryFactory factory_;
- geos::io::WKTReader reader_;
-
- test_convexhull_data()
- : pm_(1), factory_(&pm_, 0), reader_(&factory_)
- {}
- };
-
- typedef test_group<test_convexhull_data> group;
- typedef group::object object;
-
- group test_convexhull_group("geos::algorithm::ConvexHull");
-
- //
- // Test Cases
- //
-
- // 1 - Test convex hull of linestring
- template<>
- template<>
- void object::test<1>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr lineGeom(reader_.read("LINESTRING (30 220, 240 220, 240 220)"));
- LineStringAPtr line(dynamic_cast_auto_ptr<LineString>(lineGeom));
- ensure(0 != line.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (30 220, 240 220)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(line->convexHull()) );
- }
-
- // 2 - Test convex hull of multipoint
- template<>
- template<>
- void object::test<2>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (130 240, 130 240, 130 240, 570 240, 570 240, 570 240, 650 240)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (130 240, 650 240)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(geom->convexHull()) );
- }
-
- // 3 - Test convex hull of multipoint
- template<>
- template<>
- void object::test<3>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 0 0, 10 0)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(geom->convexHull()) );
- }
-
- // 4 - Test convex hull of multipoint
- template<>
- template<>
- void object::test<4>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 10 0, 10 0)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(geom->convexHull()) );
- }
-
- // 5 - Test convex hull of multipoint
- template<>
- template<>
- void object::test<5>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 5 0, 10 0)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(geom->convexHull()) );
- }
-
- // 6 - Test convex hull of multipoint exported to string form
- template<>
- template<>
- void object::test<6>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 5 1, 10 0)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(geom->convexHull());
- ensure(0 != hullGeom.get());
-
- GeometryAPtr expectedHull(reader_.read("POLYGON ((0 0, 5 1, 10 0, 0 0))"));
- ensure(0 != expectedHull.get());
-
- ensure_equals( hullGeom->toString(), expectedHull->toString() );
- }
-
- // 7 - Test convex hull of multipoint
- template<>
- template<>
- void object::test<7>()
- {
- using geos::geom::LineString;
- using utility::dynamic_cast_auto_ptr;
-
- GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 0 0, 5 0, 5 0, 10 0, 10 0)"));
- ensure(0 != geom.get());
-
- GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
- LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
- ensure(0 != convexHull.get());
-
- ensure( convexHull->equalsExact(geom->convexHull()) );
- }
-
-} // namespace tut
+// $Id$
+//
+// Test Suite for geos::algorithm::ConvexHull
+// Ported from JTS junit/algorithm/ConvexHullTest.java
+
+// tut
+#include <tut.h>
+#include <utility.h>
+// geos
+#include <geos/algorithm/ConvexHull.h>
+#include <geos/geom/LineString.h>
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/CoordinateArraySequence.h>
+#include <geos/geom/Dimension.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/GeometryFactory.h>
+#include <geos/geom/PrecisionModel.h>
+#include <geos/io/WKTReader.h>
+// std
+#include <sstream>
+#include <memory>
+
+namespace geos {
+ namespace geom {
+ class Geometry;
+ }
+}
+
+using namespace geos::geom; // for Location
+
+namespace tut
+{
+ //
+ // Test Group
+ //
+
+ // dummy data, not used
+ struct test_convexhull_data
+ {
+ // Typedefs used as short names by test cases
+ typedef std::auto_ptr<geos::geom::Geometry> GeometryAPtr;
+ typedef std::auto_ptr<geos::geom::LineString> LineStringAPtr;
+
+ geos::geom::PrecisionModel pm_;
+ geos::geom::GeometryFactory factory_;
+ geos::io::WKTReader reader_;
+
+ test_convexhull_data()
+ : pm_(1), factory_(&pm_, 0), reader_(&factory_)
+ {}
+ };
+
+ typedef test_group<test_convexhull_data> group;
+ typedef group::object object;
+
+ group test_convexhull_group("geos::algorithm::ConvexHull");
+
+ //
+ // Test Cases
+ //
+
+ // 1 - Test convex hull of linestring
+ template<>
+ template<>
+ void object::test<1>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr lineGeom(reader_.read("LINESTRING (30 220, 240 220, 240 220)"));
+ LineStringAPtr line(dynamic_cast_auto_ptr<LineString>(lineGeom));
+ ensure(0 != line.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (30 220, 240 220)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(line->convexHull()) );
+ }
+
+ // 2 - Test convex hull of multipoint
+ template<>
+ template<>
+ void object::test<2>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (130 240, 130 240, 130 240, 570 240, 570 240, 570 240, 650 240)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (130 240, 650 240)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(geom->convexHull()) );
+ }
+
+ // 3 - Test convex hull of multipoint
+ template<>
+ template<>
+ void object::test<3>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 0 0, 10 0)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(geom->convexHull()) );
+ }
+
+ // 4 - Test convex hull of multipoint
+ template<>
+ template<>
+ void object::test<4>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 10 0, 10 0)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(geom->convexHull()) );
+ }
+
+ // 5 - Test convex hull of multipoint
+ template<>
+ template<>
+ void object::test<5>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 5 0, 10 0)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(geom->convexHull()) );
+ }
+
+ // 6 - Test convex hull of multipoint exported to string form
+ template<>
+ template<>
+ void object::test<6>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 5 1, 10 0)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(geom->convexHull());
+ ensure(0 != hullGeom.get());
+
+ GeometryAPtr expectedHull(reader_.read("POLYGON ((0 0, 5 1, 10 0, 0 0))"));
+ ensure(0 != expectedHull.get());
+
+ ensure_equals( hullGeom->toString(), expectedHull->toString() );
+ }
+
+ // 7 - Test convex hull of multipoint
+ template<>
+ template<>
+ void object::test<7>()
+ {
+ using geos::geom::LineString;
+ using utility::dynamic_cast_auto_ptr;
+
+ GeometryAPtr geom(reader_.read("MULTIPOINT (0 0, 0 0, 5 0, 5 0, 10 0, 10 0)"));
+ ensure(0 != geom.get());
+
+ GeometryAPtr hullGeom(reader_.read("LINESTRING (0 0, 10 0)"));
+ LineStringAPtr convexHull(dynamic_cast_auto_ptr<LineString>(hullGeom));
+ ensure(0 != convexHull.get());
+
+ ensure( convexHull->equalsExact(geom->convexHull()) );
+ }
+
+} // namespace tut
Modified: trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp
===================================================================
--- trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp 2008-08-12 00:09:34 UTC (rev 2155)
+++ trunk/tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp 2008-08-12 00:23:44 UTC (rev 2156)
@@ -43,6 +43,7 @@
void object::test<1>()
{
prep::PreparedGeometryFactory pgf;
+ (void)pgf;
}
// Test passing null-pointer to prepare static method
@@ -60,6 +61,7 @@
void object::test<3>()
{
prep::PreparedGeometryFactory pgf;
+ (void)pgf;
// FIXME: null pointer throws segfault (Ticket #197)
// ensure(0 == pgf.create(0));
Modified: trunk/tests/unit/operation/IsSimpleOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/IsSimpleOpTest.cpp 2008-08-12 00:09:34 UTC (rev 2155)
+++ trunk/tests/unit/operation/IsSimpleOpTest.cpp 2008-08-12 00:23:44 UTC (rev 2156)
@@ -1,102 +1,102 @@
-// $Id$
-//
-// Test Suite for geos::operation::IsSimpleOp class
-// Ported from JTS junit/operation/IsSimpleTest.java
-
-// tut
-#include <tut.h>
-// geos
-#include <geos/operation/IsSimpleOp.h>
-#include <geos/geom/Coordinate.h>
-#include <geos/geom/Dimension.h>
-#include <geos/geom/Geometry.h>
-#include <geos/geom/GeometryFactory.h>
-#include <geos/geom/PrecisionModel.h>
-#include <geos/io/WKTReader.h>
-// std
-#include <string>
-#include <memory>
-
-using namespace geos::geom;
-using namespace geos::operation;
-
-namespace tut
-{
- //
- // Test Group
- //
-
- struct test_issimpleop_data
- {
- geos::geom::PrecisionModel pm_;
- geos::geom::GeometryFactory factory_;
- geos::io::WKTReader reader_;
- double tolerance_;
-
- test_issimpleop_data()
- : pm_(1), factory_(&pm_, 0), reader_(&factory_), tolerance_(0.00005)
- {}
- };
-
- typedef test_group<test_issimpleop_data> group;
- typedef group::object object;
-
- group test_issimpleop_group("geos::operation::IsSimpleOp");
-
- //
- // Test Cases
- //
-
- // 1 - Test cross
- template<>
- template<>
- void object::test<1>()
- {
- const std::string wkt("MULTILINESTRING ((20 120, 120 20), (20 20, 120 120))");
- const Geometry::AutoPtr geom(reader_.read(wkt));
-
- // TODO - mloskot: What about support of new features of BoundaryNodeRule, in JTS
-
- IsSimpleOp op;
- bool simple = op.isSimpleLinearGeometry(geom.get());
-
- ensure( false == simple );
-
- // TODO - mloskot:
- // There are missing features not (re)implemented in IsSimpleOp, in GEOS.
- // So, all tests in this suite have been simplified in comparison to original JTS tests.
- //
- //Coordinate loc(70, 70);
- //Coordinate nonSimpleLoc = op.getNonSimpleLocation();
- //loc.distance(nonSimpleLoc) < TOLERANCE
- }
-
- // 2 - Test MultiLineString with ring touching at the end point
- template<>
- template<>
- void object::test<2>()
- {
- const std::string wkt("MULTILINESTRING ((100 100, 20 20, 200 20, 100 100), (100 200, 100 100))");
- const Geometry::AutoPtr geom(reader_.read(wkt));
-
- IsSimpleOp op;
- bool simple = op.isSimpleLinearGeometry(geom.get());
-
- ensure( false == simple );
- }
-
- // 3 - Test simple LineString
- template<>
- template<>
- void object::test<3>()
- {
- const std::string wkt("LINESTRING (100 100, 20 20, 200 20, 100 100)");
- const Geometry::AutoPtr geom(reader_.read(wkt));
-
- IsSimpleOp op;
- bool simple = op.isSimpleLinearGeometry(geom.get());
-
- ensure( true == simple );
- }
-
-} // namespace tut
+// $Id$
+//
+// Test Suite for geos::operation::IsSimpleOp class
+// Ported from JTS junit/operation/IsSimpleTest.java
+
+// tut
+#include <tut.h>
+// geos
+#include <geos/operation/IsSimpleOp.h>
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/Dimension.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/GeometryFactory.h>
+#include <geos/geom/PrecisionModel.h>
+#include <geos/io/WKTReader.h>
+// std
+#include <string>
+#include <memory>
+
+using namespace geos::geom;
+using namespace geos::operation;
+
+namespace tut
+{
+ //
+ // Test Group
+ //
+
+ struct test_issimpleop_data
+ {
+ geos::geom::PrecisionModel pm_;
+ geos::geom::GeometryFactory factory_;
+ geos::io::WKTReader reader_;
+ double tolerance_;
+
+ test_issimpleop_data()
+ : pm_(1), factory_(&pm_, 0), reader_(&factory_), tolerance_(0.00005)
+ {}
+ };
+
+ typedef test_group<test_issimpleop_data> group;
+ typedef group::object object;
+
+ group test_issimpleop_group("geos::operation::IsSimpleOp");
+
+ //
+ // Test Cases
+ //
+
+ // 1 - Test cross
+ template<>
+ template<>
+ void object::test<1>()
+ {
+ const std::string wkt("MULTILINESTRING ((20 120, 120 20), (20 20, 120 120))");
+ const Geometry::AutoPtr geom(reader_.read(wkt));
+
+ // TODO - mloskot: What about support of new features of BoundaryNodeRule, in JTS
+
+ IsSimpleOp op;
+ bool simple = op.isSimpleLinearGeometry(geom.get());
+
+ ensure( false == simple );
+
+ // TODO - mloskot:
+ // There are missing features not (re)implemented in IsSimpleOp, in GEOS.
+ // So, all tests in this suite have been simplified in comparison to original JTS tests.
+ //
+ //Coordinate loc(70, 70);
+ //Coordinate nonSimpleLoc = op.getNonSimpleLocation();
+ //loc.distance(nonSimpleLoc) < TOLERANCE
+ }
+
+ // 2 - Test MultiLineString with ring touching at the end point
+ template<>
+ template<>
+ void object::test<2>()
+ {
+ const std::string wkt("MULTILINESTRING ((100 100, 20 20, 200 20, 100 100), (100 200, 100 100))");
+ const Geometry::AutoPtr geom(reader_.read(wkt));
+
+ IsSimpleOp op;
+ bool simple = op.isSimpleLinearGeometry(geom.get());
+
+ ensure( false == simple );
+ }
+
+ // 3 - Test simple LineString
+ template<>
+ template<>
+ void object::test<3>()
+ {
+ const std::string wkt("LINESTRING (100 100, 20 20, 200 20, 100 100)");
+ const Geometry::AutoPtr geom(reader_.read(wkt));
+
+ IsSimpleOp op;
+ bool simple = op.isSimpleLinearGeometry(geom.get());
+
+ ensure( true == simple );
+ }
+
+} // namespace tut
More information about the geos-commits
mailing list