[geos-commits] r2761 - in trunk/tests/unit: algorithm capi geom io
linearref noding
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Dec 3 13:56:26 EST 2009
Author: mloskot
Date: 2009-12-03 13:56:25 -0500 (Thu, 03 Dec 2009)
New Revision: 2761
Modified:
trunk/tests/unit/algorithm/RobustLineIntersectionTest.cpp
trunk/tests/unit/capi/GEOSBufferTest.cpp
trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp
trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp
trunk/tests/unit/geom/CoordinateTest.cpp
trunk/tests/unit/geom/GeometryFactoryTest.cpp
trunk/tests/unit/geom/IntersectionMatrixTest.cpp
trunk/tests/unit/geom/LinearRingTest.cpp
trunk/tests/unit/geom/MultiPointTest.cpp
trunk/tests/unit/geom/PolygonTest.cpp
trunk/tests/unit/geom/TriangleTest.cpp
trunk/tests/unit/io/ByteOrderValuesTest.cpp
trunk/tests/unit/linearref/LengthIndexedLineTest.cpp
trunk/tests/unit/noding/BasicSegmentStringTest.cpp
trunk/tests/unit/noding/NodedSegmentStringTest.cpp
Log:
Part 1 of larger changeset - tests/unit:
* Declare noncopyable types as such explicitly (Ticket #304).
* Cleanup.
* Unified EOL to LF.
Modified: trunk/tests/unit/algorithm/RobustLineIntersectionTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/RobustLineIntersectionTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/algorithm/RobustLineIntersectionTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -123,8 +123,8 @@
LineString* l1ptr = dynamic_cast<LineString*>(g1.get());
LineString* l2ptr = dynamic_cast<LineString*>(g2.get());
- ensure(l1ptr);
- ensure(l2ptr);
+ ensure(0 != l1ptr);
+ ensure(0 != l2ptr);
LineString& l1 = *l1ptr;
LineString& l2 = *l2ptr;
@@ -160,8 +160,8 @@
LineString* l1ptr = dynamic_cast<LineString*>(g1.get());
LineString* l2ptr = dynamic_cast<LineString*>(g2.get());
- ensure(l1ptr);
- ensure(l2ptr);
+ ensure(0 != l1ptr);
+ ensure(0 != l2ptr);
LineString& l1 = *l1ptr;
LineString& l2 = *l2ptr;
Modified: trunk/tests/unit/capi/GEOSBufferTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSBufferTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/capi/GEOSBufferTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -146,7 +146,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 7);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 161.803, 0.001);
}
@@ -168,7 +168,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 11);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 182.514, 0.001);
}
@@ -190,7 +190,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 7);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 211.803, 0.001);
}
@@ -213,7 +213,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 5);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 111.803, 0.001);
}
@@ -235,7 +235,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 5);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 50.0, 0.001);
ensure_equals(std::string(wkt_), std::string(
@@ -261,7 +261,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 7);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 150.0, 0.001);
ensure_equals(std::string(wkt_), std::string(
@@ -288,7 +288,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 29);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 244.615, 0.001);
}
@@ -312,7 +312,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 9);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 250.0, 0.001);
ensure_equals(std::string(wkt_), std::string(
@@ -339,7 +339,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 10);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 237.5, 0.001);
ensure_equals(std::string(wkt_), std::string(
@@ -367,7 +367,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 10);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 237.5, 0.001);
ensure_equals(std::string(wkt_), std::string(
@@ -393,7 +393,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 7);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 127.452, 0.001);
}
@@ -416,7 +416,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 6);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 139.043, 0.001);
}
@@ -439,7 +439,7 @@
ensure_equals(GEOSGetNumCoordinates(geom2_), 4);
- ensure(GEOSArea(geom2_, &area_));
+ ensure(0 != GEOSArea(geom2_, &area_));
ensure_distance(area_, 141.598, 0.001);
}
Modified: trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -65,6 +65,7 @@
ensure("GEOSGeomFromWKB_buf failed to create geometry", 0 != geom1_ );
// TODO: Update test to compare with WKT-based geometry
+ (void)wkt;
// ATM, some XYZ and XYZM geometries fail
//geom2_ = GEOSWKTReader_read(reader_, wkt.c_str());
//ensure ( 0 != geom2_ );
Modified: trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -82,7 +82,7 @@
// docs say so
//geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(0 != prepGeom1_);
}
@@ -102,7 +102,7 @@
// docs say so
//geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(0 != prepGeom1_);
int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
ensure_equals(ret, 1);
@@ -125,7 +125,7 @@
// docs say so
//geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(0 != prepGeom1_);
int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
ensure_equals(ret, 0);
Modified: trunk/tests/unit/geom/CoordinateTest.cpp
===================================================================
--- trunk/tests/unit/geom/CoordinateTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/CoordinateTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -22,6 +22,10 @@
test_coordinate_data()
: x(1.234), y(2.345), z(3.456)
{}
+ private:
+ // Declare type as noncopyable
+ test_coordinate_data(test_coordinate_data const& other);
+ test_coordinate_data& operator=(test_coordinate_data const& rhs);
};
typedef test_group<test_coordinate_data> group;
@@ -50,7 +54,7 @@
geos::geom::Coordinate coord;
ensure_equals( coord.x, 0.0 );
ensure_equals( coord.y, 0.0 );
- ensure( ISNAN( coord.z ) );
+ ensure(0 != ISNAN( coord.z ) );
}
// Test of copy constructor and assignment operator
@@ -172,16 +176,16 @@
// Make it null and check
not_null_coord.setNull();
- ensure( ISNAN( not_null_coord.x ) );
- ensure( ISNAN( not_null_coord.y ) );
- ensure( ISNAN( not_null_coord.z ) );
+ ensure( 0 != ISNAN( not_null_coord.x ) );
+ ensure( 0 != ISNAN( not_null_coord.y ) );
+ ensure( 0 != ISNAN( not_null_coord.z ) );
// Build in static null instance
geos::geom::Coordinate null_coord;
null_coord = geos::geom::Coordinate::getNull();
- ensure( ISNAN( null_coord.x ) );
- ensure( ISNAN( null_coord.y ) );
- ensure( ISNAN( null_coord.z ) );
+ ensure( 0 != ISNAN( null_coord.x ) );
+ ensure( 0 != ISNAN( null_coord.y ) );
+ ensure( 0 != ISNAN( null_coord.z ) );
}
} // namespace tut
Modified: trunk/tests/unit/geom/GeometryFactoryTest.cpp
===================================================================
--- trunk/tests/unit/geom/GeometryFactoryTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/GeometryFactoryTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -46,22 +46,26 @@
//
// Common data used by tests
- struct test_geometryfactory_data
- {
- // Test data
- const int x_;
- const int y_;
- const int z_;
+ struct test_geometryfactory_data
+ {
+ // Test data
+ const int x_;
+ const int y_;
+ const int z_;
- const int srid_;
- geos::geom::PrecisionModel pm_;
- geos::geom::GeometryFactory factory_;
- geos::io::WKTReader reader_;
+ const int srid_;
+ geos::geom::PrecisionModel pm_;
+ geos::geom::GeometryFactory factory_;
+ geos::io::WKTReader reader_;
- test_geometryfactory_data()
- : x_(5), y_(10), z_(15), srid_(666), pm_(1.0), factory_(&pm_, srid_), reader_(&factory_)
- {}
- };
+ test_geometryfactory_data()
+ : x_(5), y_(10), z_(15), srid_(666), pm_(1.0), factory_(&pm_, srid_), reader_(&factory_)
+ {}
+ private:
+ // Declare type as noncopyable
+ test_geometryfactory_data(const test_geometryfactory_data& other);
+ test_geometryfactory_data& operator=(const test_geometryfactory_data& rhs);
+ };
typedef test_group<test_geometryfactory_data> group;
typedef group::object object;
Modified: trunk/tests/unit/geom/IntersectionMatrixTest.cpp
===================================================================
--- trunk/tests/unit/geom/IntersectionMatrixTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/IntersectionMatrixTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -19,17 +19,21 @@
// Common data used by test cases
struct test_intersectionmatrix_data
- {
- typedef geos::geom::IntersectionMatrix* MatrixPtr;
- typedef geos::geom::IntersectionMatrix const* MatrixCPtr;
+ {
+ typedef geos::geom::IntersectionMatrix* MatrixPtr;
+ typedef geos::geom::IntersectionMatrix const* MatrixCPtr;
- const std::string pattern_false_;
- geos::geom::IntersectionMatrix im_;
+ const std::string pattern_false_;
+ geos::geom::IntersectionMatrix im_;
- test_intersectionmatrix_data()
- : pattern_false_("FFFFFFFFF"),im_(pattern_false_)
- {}
- };
+ test_intersectionmatrix_data()
+ : pattern_false_("FFFFFFFFF"),im_(pattern_false_)
+ {}
+ private:
+ // Declare type as noncopyable
+ test_intersectionmatrix_data(const test_intersectionmatrix_data& other);
+ test_intersectionmatrix_data& operator=(const test_intersectionmatrix_data& rhs);
+ };
typedef test_group<test_intersectionmatrix_data> group;
typedef group::object object;
Modified: trunk/tests/unit/geom/LinearRingTest.cpp
===================================================================
--- trunk/tests/unit/geom/LinearRingTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/LinearRingTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -62,7 +62,12 @@
~test_linearring_data()
{
factory_.destroyGeometry(ring_);
- }
+ }
+
+ private:
+ // Declare type as noncopyable
+ test_linearring_data(const test_linearring_data& other);
+ test_linearring_data& operator=(const test_linearring_data& rhs);
};
typedef test_group<test_linearring_data> group;
Modified: trunk/tests/unit/geom/MultiPointTest.cpp
===================================================================
--- trunk/tests/unit/geom/MultiPointTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/MultiPointTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -50,6 +50,11 @@
{
factory_.destroyGeometry(mp_);
}
+
+ private:
+ // Declare type as noncopyable
+ test_multipoint_data(const test_multipoint_data& other);
+ test_multipoint_data& operator=(const test_multipoint_data& rhs);
};
typedef test_group<test_multipoint_data> group;
Modified: trunk/tests/unit/geom/PolygonTest.cpp
===================================================================
--- trunk/tests/unit/geom/PolygonTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/PolygonTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -53,11 +53,16 @@
poly_ = static_cast<PolygonPtr>(geo);
}
- ~test_polygon_data()
- {
- // FREE MEMORY
- factory_.destroyGeometry(poly_);
- }
+ ~test_polygon_data()
+ {
+ // FREE MEMORY
+ factory_.destroyGeometry(poly_);
+ }
+
+ private:
+ // Declare type as noncopyable
+ test_polygon_data(const test_polygon_data& other);
+ test_polygon_data& operator=(const test_polygon_data& rhs);
};
typedef test_group<test_polygon_data> group;
Modified: trunk/tests/unit/geom/TriangleTest.cpp
===================================================================
--- trunk/tests/unit/geom/TriangleTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/geom/TriangleTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -113,6 +113,6 @@
ensure( fabs(center.x - 6.0) < 1e-15 );
ensure( center.y > 4.2 );
ensure( center.y < 4.3 );
- ensure( ISNAN( center.z ) );
+ ensure( 0 != ISNAN( center.z ) );
}
} // namespace tut
Modified: trunk/tests/unit/io/ByteOrderValuesTest.cpp
===================================================================
--- trunk/tests/unit/io/ByteOrderValuesTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/io/ByteOrderValuesTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -128,8 +128,7 @@
ensure("putLong big endian[6]", buf[6] == 0);
ensure("putLong big endian[7]", buf[7] == 2);
- out = ByteOrderValues::getLong(buf,
- ByteOrderValues::ENDIAN_BIG);
+ out = static_cast<long>(ByteOrderValues::getLong(buf, ByteOrderValues::ENDIAN_BIG));
ensure_equals("getLong big endian", out, in);
ByteOrderValues::putLong(in, buf,
@@ -143,8 +142,7 @@
ensure("putLong little endian[6]", buf[6] == 0);
ensure("putLong little endian[7]", buf[7] == 0);
- out = ByteOrderValues::getLong(buf,
- ByteOrderValues::ENDIAN_LITTLE);
+ out = static_cast<long>(ByteOrderValues::getLong(buf, ByteOrderValues::ENDIAN_LITTLE));
ensure_equals("getLong little endian", out, in);
}
Modified: trunk/tests/unit/linearref/LengthIndexedLineTest.cpp
===================================================================
--- trunk/tests/unit/linearref/LengthIndexedLineTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/linearref/LengthIndexedLineTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -411,7 +411,7 @@
LengthIndexedLine indexedLine(linearGeom.get());
double projIndex = indexedLine.project(Coordinate(5, 5));
Coordinate projPt = indexedLine.extractPoint(projIndex);
- ensure(ISNAN(projPt.z));
+ ensure(0 != ISNAN(projPt.z));
}
}
Modified: trunk/tests/unit/noding/BasicSegmentStringTest.cpp
===================================================================
--- trunk/tests/unit/noding/BasicSegmentStringTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/noding/BasicSegmentStringTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -66,7 +66,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(0, 0);
@@ -77,7 +77,7 @@
ensure_equals(cs->size(), 2u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 2u);
@@ -109,7 +109,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(1, 0);
@@ -120,7 +120,7 @@
ensure_equals(cs->size(), 2u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 2u);
@@ -145,7 +145,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(1, 0);
@@ -159,7 +159,7 @@
ensure_equals(cs->size(), 4u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 4u);
@@ -203,7 +203,7 @@
catch (...) {
testPassed = false;
}
- ensure(testPassed);
+ ensure( 0 != testPassed);
}
Modified: trunk/tests/unit/noding/NodedSegmentStringTest.cpp
===================================================================
--- trunk/tests/unit/noding/NodedSegmentStringTest.cpp 2009-12-03 14:48:08 UTC (rev 2760)
+++ trunk/tests/unit/noding/NodedSegmentStringTest.cpp 2009-12-03 18:56:25 UTC (rev 2761)
@@ -66,7 +66,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(0, 0);
@@ -77,7 +77,7 @@
ensure_equals(cs->size(), 2u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 2u);
@@ -113,7 +113,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(1, 0);
@@ -124,7 +124,7 @@
ensure_equals(cs->size(), 2u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 2u);
@@ -150,7 +150,7 @@
{
CoordinateSequenceAutoPtr cs(csFactory->create(0, 2));
- ensure(cs.get());
+ ensure(0 != cs.get());
geos::geom::Coordinate c0(0, 0);
geos::geom::Coordinate c1(1, 0);
@@ -164,7 +164,7 @@
ensure_equals(cs->size(), 4u);
SegmentStringAutoPtr ss(makeSegmentString(cs.get()));
- ensure(ss.get());
+ ensure(0 != ss.get());
ensure_equals(ss->size(), 4u);
@@ -209,7 +209,7 @@
catch (...) {
testPassed = false;
}
- ensure(testPassed);
+ ensure( 0 != testPassed);
}
// test adding intersections
More information about the geos-commits
mailing list