[geos-commits] r2424 - trunk/tests/unit/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Apr 29 19:52:36 EDT 2009
Author: mloskot
Date: 2009-04-29 19:52:36 -0400 (Wed, 29 Apr 2009)
New Revision: 2424
Modified:
trunk/tests/unit/capi/GEOSContainsTest.cpp
trunk/tests/unit/capi/GEOSCoordSeqTest.cpp
trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp
trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp
trunk/tests/unit/capi/GEOSPolygonizer_getCutEdgesTest.cpp
trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp
trunk/tests/unit/capi/GEOSSimplifyTest.cpp
trunk/tests/unit/capi/GEOSWithinTest.cpp
Log:
test/unit/capi: re-tab all .cpp files to use spaces.
Modified: trunk/tests/unit/capi/GEOSContainsTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSContainsTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSContainsTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -18,43 +18,43 @@
// Common data used in test cases.
struct test_capigeoscontains_data
- {
- GEOSGeometry* geom1_;
- GEOSGeometry* geom2_;
+ {
+ GEOSGeometry* geom1_;
+ GEOSGeometry* geom2_;
- static void notice(const char *fmt, ...)
- {
- std::fprintf( stdout, "NOTICE: ");
+ static void notice(const char *fmt, ...)
+ {
+ std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeoscontains_data()
+ test_capigeoscontains_data()
: geom1_(0), geom2_(0)
- {
- initGEOS(notice, notice);
- }
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeoscontains_data()
- {
+ ~test_capigeoscontains_data()
+ {
GEOSGeom_destroy(geom1_);
GEOSGeom_destroy(geom2_);
geom1_ = 0;
geom2_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeoscontains_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeoscontains_data> group;
+ typedef group::object object;
- group test_capigeoscontains_group("capi::GEOSContains");
+ group test_capigeoscontains_group("capi::GEOSContains");
//
// Test Cases
@@ -64,57 +64,57 @@
template<>
void object::test<1>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
- geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
- ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom1_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSContains(geom1_, geom2_);
- ensure_equals(r1, 0);
+ ensure_equals(r1, 0);
char const r2 = GEOSContains(geom2_, geom1_);
- ensure_equals(r2, 0);
+ ensure_equals(r2, 0);
}
template<>
template<>
void object::test<2>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
- geom2_ = GEOSGeomFromWKT("POINT(2 2)");
-
+ geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
+ geom2_ = GEOSGeomFromWKT("POINT(2 2)");
+
ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSContains(geom1_, geom2_);
- ensure_equals(int(r1), 1);
+ ensure_equals(int(r1), 1);
char const r2 = GEOSContains(geom2_, geom1_);
- ensure_equals(int(r2), 0);
+ ensure_equals(int(r2), 0);
}
template<>
template<>
void object::test<3>()
{
- geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
- geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");
-
+ geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
+ geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");
+
ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSContains(geom1_, geom2_);
- ensure_equals(int(r1), 1);
+ ensure_equals(int(r1), 1);
char const r2 = GEOSContains(geom2_, geom1_);
- ensure_equals(int(r2), 0);
+ ensure_equals(int(r2), 0);
}
} // namespace tut
Modified: trunk/tests/unit/capi/GEOSCoordSeqTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSCoordSeqTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSCoordSeqTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -19,40 +19,40 @@
// Common data used in test cases.
struct test_capigeoscoordseq_data
- {
+ {
GEOSCoordSequence* cs_;
- static void notice(const char *fmt, ...)
- {
+ static void notice(const char *fmt, ...)
+ {
std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeoscoordseq_data() : cs_(0)
- {
- initGEOS(notice, notice);
- }
+ test_capigeoscoordseq_data() : cs_(0)
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeoscoordseq_data()
- {
+ ~test_capigeoscoordseq_data()
+ {
GEOSCoordSeq_destroy(cs_);
cs_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeoscoordseq_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeoscoordseq_data> group;
+ typedef group::object object;
- group test_capigeoscoordseq_group("capi::GEOSCoordSeq");
+ group test_capigeoscoordseq_group("capi::GEOSCoordSeq");
//
// Test Cases
@@ -63,177 +63,177 @@
template<>
void object::test<1>()
{
- cs_ = GEOSCoordSeq_create(5, 3);
-
- unsigned int size;
- unsigned int dims;
+ cs_ = GEOSCoordSeq_create(5, 3);
+
+ unsigned int size;
+ unsigned int dims;
- ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
- ensure_equals( size, 5u );
+ ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
+ ensure_equals( size, 5u );
- ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
- ensure_equals( dims, 3u );
+ ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
+ ensure_equals( dims, 3u );
- for (unsigned int i=0; i<5; ++i)
- {
- double x = i*10;
- double y = i*10+1;
- double z = i*10+2;
+ for (unsigned int i=0; i<5; ++i)
+ {
+ double x = i*10;
+ double y = i*10+1;
+ double z = i*10+2;
- GEOSCoordSeq_setX(cs_, i, x);
- GEOSCoordSeq_setY(cs_, i, y);
- GEOSCoordSeq_setZ(cs_, i, z);
+ GEOSCoordSeq_setX(cs_, i, x);
+ GEOSCoordSeq_setY(cs_, i, y);
+ GEOSCoordSeq_setZ(cs_, i, z);
- double xcheck, ycheck, zcheck;
- ensure( 0 != GEOSCoordSeq_getX(cs_, i, &xcheck) );
- ensure( 0 != GEOSCoordSeq_getY(cs_, i, &ycheck) );
- ensure( 0 != GEOSCoordSeq_getZ(cs_, i, &zcheck) );
+ double xcheck, ycheck, zcheck;
+ ensure( 0 != GEOSCoordSeq_getX(cs_, i, &xcheck) );
+ ensure( 0 != GEOSCoordSeq_getY(cs_, i, &ycheck) );
+ ensure( 0 != GEOSCoordSeq_getZ(cs_, i, &zcheck) );
- ensure_equals( xcheck, x );
- ensure_equals( ycheck, y );
- ensure_equals( zcheck, z );
- }
- }
+ ensure_equals( xcheck, x );
+ ensure_equals( ycheck, y );
+ ensure_equals( zcheck, z );
+ }
+ }
// Test not swapped setX/setY calls (see bug #133, fixed)
template<>
template<>
void object::test<2>()
{
- cs_ = GEOSCoordSeq_create(1, 3);
-
- unsigned int size;
- unsigned int dims;
+ cs_ = GEOSCoordSeq_create(1, 3);
+
+ unsigned int size;
+ unsigned int dims;
- ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
- ensure_equals( size, 1u );
+ ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
+ ensure_equals( size, 1u );
- ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
- ensure_equals( dims, 3u );
+ ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
+ ensure_equals( dims, 3u );
- double x = 10;
- double y = 11;
- double z = 12;
+ double x = 10;
+ double y = 11;
+ double z = 12;
// X, Y, Z
- GEOSCoordSeq_setX(cs_, 0, x);
- GEOSCoordSeq_setY(cs_, 0, y);
- GEOSCoordSeq_setZ(cs_, 0, z);
+ GEOSCoordSeq_setX(cs_, 0, x);
+ GEOSCoordSeq_setY(cs_, 0, y);
+ GEOSCoordSeq_setZ(cs_, 0, z);
- double xcheck, ycheck, zcheck;
- ensure( 0 != GEOSCoordSeq_getY(cs_, 0, &ycheck) );
- ensure( 0 != GEOSCoordSeq_getX(cs_, 0, &xcheck) );
- ensure( 0 != GEOSCoordSeq_getZ(cs_, 0, &zcheck) );
+ double xcheck, ycheck, zcheck;
+ ensure( 0 != GEOSCoordSeq_getY(cs_, 0, &ycheck) );
+ ensure( 0 != GEOSCoordSeq_getX(cs_, 0, &xcheck) );
+ ensure( 0 != GEOSCoordSeq_getZ(cs_, 0, &zcheck) );
- ensure_equals( xcheck, x );
- ensure_equals( ycheck, y );
- ensure_equals( zcheck, z );
- }
+ ensure_equals( xcheck, x );
+ ensure_equals( ycheck, y );
+ ensure_equals( zcheck, z );
+ }
// Test not swapped setOrdinate calls (see bug #133, fixed)
template<>
template<>
void object::test<3>()
{
- cs_ = GEOSCoordSeq_create(1, 3);
-
- unsigned int size;
- unsigned int dims;
+ cs_ = GEOSCoordSeq_create(1, 3);
+
+ unsigned int size;
+ unsigned int dims;
- ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
- ensure_equals( size, 1u );
+ ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
+ ensure_equals( size, 1u );
- ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
- ensure_equals( dims, 3u );
+ ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
+ ensure_equals( dims, 3u );
- double x = 10;
- double y = 11;
- double z = 12;
+ double x = 10;
+ double y = 11;
+ double z = 12;
// X, Y, Z
- GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
- GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
- GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
- double xcheck, ycheck, zcheck;
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck) );
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 0, &xcheck) );
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 2, &zcheck) );
+ double xcheck, ycheck, zcheck;
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck) );
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 0, &xcheck) );
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 2, &zcheck) );
- ensure_equals( xcheck, x );
- ensure_equals( ycheck, y );
- ensure_equals( zcheck, z );
- }
+ ensure_equals( xcheck, x );
+ ensure_equals( ycheck, y );
+ ensure_equals( zcheck, z );
+ }
// Test swapped setX calls (see bug #133, fixed)
template<>
template<>
void object::test<4>()
{
- cs_ = GEOSCoordSeq_create(1, 3);
-
- unsigned int size;
- unsigned int dims;
+ cs_ = GEOSCoordSeq_create(1, 3);
+
+ unsigned int size;
+ unsigned int dims;
- ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
- ensure_equals( size, 1u );
+ ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
+ ensure_equals( size, 1u );
- ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
- ensure_equals( dims, 3u );
+ ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
+ ensure_equals( dims, 3u );
- double x = 10;
- double y = 11;
- double z = 12;
+ double x = 10;
+ double y = 11;
+ double z = 12;
// Y, X, Z
- GEOSCoordSeq_setY(cs_, 0, y);
- GEOSCoordSeq_setX(cs_, 0, x);
- GEOSCoordSeq_setZ(cs_, 0, z);
+ GEOSCoordSeq_setY(cs_, 0, y);
+ GEOSCoordSeq_setX(cs_, 0, x);
+ GEOSCoordSeq_setZ(cs_, 0, z);
- double xcheck, ycheck, zcheck;
- ensure( 0 != GEOSCoordSeq_getY(cs_, 0, &ycheck) );
- ensure( 0 != GEOSCoordSeq_getX(cs_, 0, &xcheck) );
- ensure( 0 != GEOSCoordSeq_getZ(cs_, 0, &zcheck) );
+ double xcheck, ycheck, zcheck;
+ ensure( 0 != GEOSCoordSeq_getY(cs_, 0, &ycheck) );
+ ensure( 0 != GEOSCoordSeq_getX(cs_, 0, &xcheck) );
+ ensure( 0 != GEOSCoordSeq_getZ(cs_, 0, &zcheck) );
- ensure_equals( xcheck, x );
- ensure_equals( ycheck, y );
- ensure_equals( zcheck, z );
- }
+ ensure_equals( xcheck, x );
+ ensure_equals( ycheck, y );
+ ensure_equals( zcheck, z );
+ }
// Test swapped setOrdinate calls (see bug #133, fixed)
template<>
template<>
void object::test<5>()
{
- cs_ = GEOSCoordSeq_create(1, 3);
-
- unsigned int size;
- unsigned int dims;
+ cs_ = GEOSCoordSeq_create(1, 3);
+
+ unsigned int size;
+ unsigned int dims;
- ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
- ensure_equals( size, 1u );
+ ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
+ ensure_equals( size, 1u );
- ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
- ensure_equals( dims, 3u );
+ ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
+ ensure_equals( dims, 3u );
- double x = 10;
- double y = 11;
- double z = 12;
+ double x = 10;
+ double y = 11;
+ double z = 12;
// Y, X, Z
- GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
- GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
- GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
+ GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
- double xcheck, ycheck, zcheck;
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck) );
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 0, &xcheck) );
- ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 2, &zcheck) );
+ double xcheck, ycheck, zcheck;
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck) );
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 0, &xcheck) );
+ ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 2, &zcheck) );
- ensure_equals( xcheck, x );
- ensure_equals( ycheck, y );
- ensure_equals( zcheck, z );
- }
+ ensure_equals( xcheck, x );
+ ensure_equals( ycheck, y );
+ ensure_equals( zcheck, z );
+ }
} // namespace tut
Modified: trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSGeomFromWKBTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -21,32 +21,32 @@
// Common data used in test cases.
struct test_capigeosgeomfromwkb_data
- {
- GEOSGeometry* geom1_;
+ {
+ GEOSGeometry* geom1_;
GEOSGeometry* geom2_;
GEOSWKTReader* reader_;
- static void notice(const char *fmt, ...)
- {
+ static void notice(const char *fmt, ...)
+ {
std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeosgeomfromwkb_data()
+ test_capigeosgeomfromwkb_data()
: geom1_(0), geom2_(0), reader_(0)
- {
- initGEOS(notice, notice);
+ {
+ initGEOS(notice, notice);
reader_ = GEOSWKTReader_create();
- }
+ }
- ~test_capigeosgeomfromwkb_data()
- {
+ ~test_capigeosgeomfromwkb_data()
+ {
GEOSGeom_destroy(geom2_);
geom2_ = 0;
GEOSGeom_destroy(geom1_);
@@ -54,7 +54,7 @@
GEOSWKTReader_destroy(reader_);
reader_ = 0;
finishGEOS();
- }
+ }
void test_wkb(std::string const& wkbhex, std::string const& wkt)
{
@@ -71,12 +71,12 @@
//char result = GEOSEquals(geom1_, geom2_);
//ensure_equals(result, char(1));
}
- };
+ };
- typedef test_group<test_capigeosgeomfromwkb_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeosgeomfromwkb_data> group;
+ typedef group::object object;
- group test_capigeosgeomfromwkb_group("capi::GEOSGeomFromWKB");
+ group test_capigeosgeomfromwkb_group("capi::GEOSGeomFromWKB");
//
// Test Cases
Modified: trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -20,33 +20,33 @@
// Common data used in test cases.
struct test_capigeosgeomtowkt_data
- {
- GEOSGeometry* geom1_;
+ {
+ GEOSGeometry* geom1_;
- static void notice(const char *fmt, ...)
- {
+ static void notice(const char *fmt, ...)
+ {
std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeosgeomtowkt_data()
+ test_capigeosgeomtowkt_data()
: geom1_(0)
- {
- initGEOS(notice, notice);
- }
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeosgeomtowkt_data()
- {
+ ~test_capigeosgeomtowkt_data()
+ {
GEOSGeom_destroy(geom1_);
geom1_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
void test_wkt(std::string const& wkt)
{
@@ -55,7 +55,7 @@
char* wkt_c = GEOSGeomToWKT(geom1_);
std::string out(wkt_c);
- free(wkt_c);
+ free(wkt_c);
ensure_equals(out, wkt);
}
@@ -67,16 +67,16 @@
char* wkt_c = GEOSGeomToWKT(geom1_);
std::string out(wkt_c);
- free(wkt_c);
+ free(wkt_c);
ensure_equals(out.substr(0, n), wkt.substr(0, n));
}
- };
+ };
- typedef test_group<test_capigeosgeomtowkt_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeosgeomtowkt_data> group;
+ typedef group::object object;
- group test_capigeosgeomtowkt_group("capi::GEOSGeomToWKT");
+ group test_capigeosgeomtowkt_group("capi::GEOSGeomToWKT");
//
// Test Cases
Modified: trunk/tests/unit/capi/GEOSPolygonizer_getCutEdgesTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSPolygonizer_getCutEdgesTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSPolygonizer_getCutEdgesTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -19,35 +19,35 @@
// Common data used in test cases.
struct test_capigeospolygonizegetcutedges_data
- {
- static void notice(const char *fmt, ...)
- {
- std::fprintf( stdout, "NOTICE: ");
+ {
+ static void notice(const char *fmt, ...)
+ {
+ std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeospolygonizegetcutedges_data()
- {
- initGEOS(notice, notice);
- }
+ test_capigeospolygonizegetcutedges_data()
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeospolygonizegetcutedges_data()
- {
- finishGEOS();
- }
+ ~test_capigeospolygonizegetcutedges_data()
+ {
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeospolygonizegetcutedges_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeospolygonizegetcutedges_data> group;
+ typedef group::object object;
- group test_capigeospolygonizegetcutedges_group("capi::GEOSPolygonizeGetCutEdges");
+ group test_capigeospolygonizegetcutedges_group("capi::GEOSPolygonizeGetCutEdges");
//
// Test Cases
Modified: trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSPreparedGeometryTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -19,52 +19,52 @@
// Common data used in test cases.
struct test_capigeospreparedgeometry_data
- {
- GEOSGeometry* geom1_;
- GEOSGeometry* geom2_;
+ {
+ GEOSGeometry* geom1_;
+ GEOSGeometry* geom2_;
- const GEOSPreparedGeometry* prepGeom1_;
- const GEOSPreparedGeometry* prepGeom2_;
+ const GEOSPreparedGeometry* prepGeom1_;
+ const GEOSPreparedGeometry* prepGeom2_;
- static void notice(const char *fmt, ...)
- {
- std::fprintf( stdout, "NOTICE: ");
+ static void notice(const char *fmt, ...)
+ {
+ std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeospreparedgeometry_data()
+ test_capigeospreparedgeometry_data()
: geom1_(0), geom2_(0), prepGeom1_(0), prepGeom2_(0)
- {
- initGEOS(notice, notice);
- }
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeospreparedgeometry_data()
- {
+ ~test_capigeospreparedgeometry_data()
+ {
GEOSGeom_destroy(geom1_);
GEOSGeom_destroy(geom2_);
- GEOSPreparedGeom_destroy(prepGeom1_);
- GEOSPreparedGeom_destroy(prepGeom2_);
+ GEOSPreparedGeom_destroy(prepGeom1_);
+ GEOSPreparedGeom_destroy(prepGeom2_);
geom1_ = 0;
geom2_ = 0;
prepGeom1_ = 0;
prepGeom2_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeospreparedgeometry_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeospreparedgeometry_data> group;
+ typedef group::object object;
- group test_capigeospreparedgeometry_group("capi::GEOSPreparedGeometry");
+ group test_capigeospreparedgeometry_group("capi::GEOSPreparedGeometry");
//
// Test Cases
@@ -75,14 +75,14 @@
template<>
void object::test<1>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
- prepGeom1_ = GEOSPrepare(geom1_);
+ geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ prepGeom1_ = GEOSPrepare(geom1_);
- // ownership NOT transferred to prepGeom1, despite
- // docs say so
- //geom1_ = 0;
+ // ownership NOT transferred to prepGeom1, despite
+ // docs say so
+ //geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(prepGeom1_);
}
@@ -94,18 +94,18 @@
template<>
void object::test<2>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))");
- geom2_ = GEOSGeomFromWKT("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))");
- prepGeom1_ = GEOSPrepare(geom1_);
+ geom1_ = GEOSGeomFromWKT("POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))");
+ geom2_ = GEOSGeomFromWKT("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))");
+ prepGeom1_ = GEOSPrepare(geom1_);
- // ownership NOT transferred to prepGeom1, despite
- // docs say so
- //geom1_ = 0;
+ // ownership NOT transferred to prepGeom1, despite
+ // docs say so
+ //geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(prepGeom1_);
- int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
- ensure_equals(ret, 1);
+ int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
+ ensure_equals(ret, 1);
}
@@ -117,18 +117,18 @@
template<>
void object::test<3>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))");
- geom2_ = GEOSGeomFromWKT("POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))");
- prepGeom1_ = GEOSPrepare(geom1_);
+ geom1_ = GEOSGeomFromWKT("POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))");
+ geom2_ = GEOSGeomFromWKT("POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))");
+ prepGeom1_ = GEOSPrepare(geom1_);
- // ownership NOT transferred to prepGeom1, despite
- // docs say so
- //geom1_ = 0;
+ // ownership NOT transferred to prepGeom1, despite
+ // docs say so
+ //geom1_ = 0;
- ensure(prepGeom1_);
+ ensure(prepGeom1_);
- int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
- ensure_equals(ret, 0);
+ int ret = GEOSPreparedContainsProperly(prepGeom1_, geom2_);
+ ensure_equals(ret, 0);
}
Modified: trunk/tests/unit/capi/GEOSSimplifyTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSSimplifyTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSSimplifyTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -19,43 +19,43 @@
// Common data used in test cases.
struct test_capigeossimplify_data
- {
- GEOSGeometry* geom1_;
- GEOSGeometry* geom2_;
+ {
+ GEOSGeometry* geom1_;
+ GEOSGeometry* geom2_;
- static void notice(const char *fmt, ...)
- {
- std::fprintf( stdout, "NOTICE: ");
+ static void notice(const char *fmt, ...)
+ {
+ std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeossimplify_data()
+ test_capigeossimplify_data()
: geom1_(0), geom2_(0)
- {
- initGEOS(notice, notice);
- }
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeossimplify_data()
- {
+ ~test_capigeossimplify_data()
+ {
GEOSGeom_destroy(geom1_);
GEOSGeom_destroy(geom2_);
geom1_ = 0;
geom2_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeossimplify_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeossimplify_data> group;
+ typedef group::object object;
- group test_capigeossimplify_group("capi::GEOSSimplify");
+ group test_capigeossimplify_group("capi::GEOSSimplify");
//
// Test Cases
@@ -66,13 +66,13 @@
template<>
void object::test<1>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
- ensure ( 0 != GEOSisEmpty(geom1_) );
+ ensure ( 0 != GEOSisEmpty(geom1_) );
- geom2_ = GEOSSimplify(geom1_, 43.2);
+ geom2_ = GEOSSimplify(geom1_, 43.2);
- ensure ( 0 != GEOSisEmpty(geom2_) );
+ ensure ( 0 != GEOSisEmpty(geom2_) );
}
} // namespace tut
Modified: trunk/tests/unit/capi/GEOSWithinTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSWithinTest.cpp 2009-04-29 23:46:07 UTC (rev 2423)
+++ trunk/tests/unit/capi/GEOSWithinTest.cpp 2009-04-29 23:52:36 UTC (rev 2424)
@@ -18,43 +18,43 @@
// Common data used in test cases.
struct test_capigeoswithin_data
- {
- GEOSGeometry* geom1_;
- GEOSGeometry* geom2_;
+ {
+ GEOSGeometry* geom1_;
+ GEOSGeometry* geom2_;
- static void notice(const char *fmt, ...)
- {
- std::fprintf( stdout, "NOTICE: ");
+ static void notice(const char *fmt, ...)
+ {
+ std::fprintf( stdout, "NOTICE: ");
- va_list ap;
- va_start(ap, fmt);
- std::vfprintf(stdout, fmt, ap);
- va_end(ap);
-
- std::fprintf(stdout, "\n");
- }
+ va_list ap;
+ va_start(ap, fmt);
+ std::vfprintf(stdout, fmt, ap);
+ va_end(ap);
+
+ std::fprintf(stdout, "\n");
+ }
- test_capigeoswithin_data()
+ test_capigeoswithin_data()
: geom1_(0), geom2_(0)
- {
- initGEOS(notice, notice);
- }
+ {
+ initGEOS(notice, notice);
+ }
- ~test_capigeoswithin_data()
- {
+ ~test_capigeoswithin_data()
+ {
GEOSGeom_destroy(geom1_);
GEOSGeom_destroy(geom2_);
geom1_ = 0;
geom2_ = 0;
- finishGEOS();
- }
+ finishGEOS();
+ }
- };
+ };
- typedef test_group<test_capigeoswithin_data> group;
- typedef group::object object;
+ typedef test_group<test_capigeoswithin_data> group;
+ typedef group::object object;
- group test_capigeoswithin_group("capi::GEOSWithin");
+ group test_capigeoswithin_group("capi::GEOSWithin");
//
// Test Cases
@@ -64,57 +64,57 @@
template<>
void object::test<1>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
- geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
+ geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
- ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom1_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSWithin(geom1_, geom2_);
- ensure_equals(r1, 0);
+ ensure_equals(r1, 0);
char const r2 = GEOSWithin(geom2_, geom1_);
- ensure_equals(r2, 0);
+ ensure_equals(r2, 0);
}
template<>
template<>
void object::test<2>()
{
- geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
- geom2_ = GEOSGeomFromWKT("POINT(2 2)");
-
+ geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
+ geom2_ = GEOSGeomFromWKT("POINT(2 2)");
+
ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSWithin(geom1_, geom2_);
- ensure_equals(int(r1), 0);
+ ensure_equals(int(r1), 0);
char const r2 = GEOSWithin(geom2_, geom1_);
- ensure_equals(int(r2), 1);
+ ensure_equals(int(r2), 1);
}
template<>
template<>
void object::test<3>()
{
- geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
- geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");
-
+ geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
+ geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");
+
ensure( 0 != geom1_ );
- ensure( 0 != geom2_ );
+ ensure( 0 != geom2_ );
char const r1 = GEOSWithin(geom1_, geom2_);
- ensure_equals(int(r1), 0);
+ ensure_equals(int(r1), 0);
char const r2 = GEOSWithin(geom2_, geom1_);
- ensure_equals(int(r2), 1);
+ ensure_equals(int(r2), 1);
}
} // namespace tut
More information about the geos-commits
mailing list