[geos-commits] r2760 - in trunk/tests: unit/operation/valid xmltester

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Dec 3 09:48:09 EST 2009


Author: mloskot
Date: 2009-12-03 09:48:08 -0500 (Thu, 03 Dec 2009)
New Revision: 2760

Modified:
   trunk/tests/unit/operation/valid/IsValidTest.cpp
   trunk/tests/unit/operation/valid/ValidClosedRingTest.cpp
   trunk/tests/xmltester/XMLTester.cpp
Log:
* Added Visual C++ pragmas.
* Fixed implicit pointer tests for 0 (save typing is a myth, be explicit is bless).


Modified: trunk/tests/unit/operation/valid/IsValidTest.cpp
===================================================================
--- trunk/tests/unit/operation/valid/IsValidTest.cpp	2009-12-03 13:25:57 UTC (rev 2759)
+++ trunk/tests/unit/operation/valid/IsValidTest.cpp	2009-12-03 14:48:08 UTC (rev 2760)
@@ -71,7 +71,7 @@
 	ensure_equals( err->getErrorType(),
 	               TopologyValidationError::eInvalidCoordinate );
 
-	ensure(ISNAN(errCoord.y));
+	ensure(0 != ISNAN(errCoord.y));
 	ensure_equals(valid, false);
     }
 

Modified: trunk/tests/unit/operation/valid/ValidClosedRingTest.cpp
===================================================================
--- trunk/tests/unit/operation/valid/ValidClosedRingTest.cpp	2009-12-03 13:25:57 UTC (rev 2759)
+++ trunk/tests/unit/operation/valid/ValidClosedRingTest.cpp	2009-12-03 14:48:08 UTC (rev 2760)
@@ -95,7 +95,7 @@
     {
 	GeomPtr geom = fromWKT("LINEARRING (0 0, 0 10, 10 10, 10 0, 0 0)");
 	LinearRing* ring_chk = dynamic_cast<LinearRing*>(geom.get());
-	ensure(ring_chk);
+	ensure(0 != ring_chk);
 	LinearRing& ring = *ring_chk;
 	//cout << ring.toString() << endl;
 	updateNonClosedRing(ring);
@@ -119,11 +119,11 @@
     {
 	GeomPtr geom = fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1) ))");
 	Polygon* poly = dynamic_cast<Polygon*>(geom.get());
-	ensure(poly);
+	ensure(0 != poly);
 	const LineString* ring = poly->getExteriorRing();
 
 	const LinearRing* lr = dynamic_cast<const LinearRing*>(ring);
-	ensure(lr);
+	ensure(0 != lr);
 
 	LinearRing* nclr = const_cast<LinearRing*>(lr);
 
@@ -138,11 +138,11 @@
     {
 	GeomPtr geom = fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1) ))");
 	Polygon* poly = dynamic_cast<Polygon*>(geom.get());
-	ensure(poly);
+	ensure(0 != poly);
 	const LineString* ring = poly->getInteriorRingN(0);
 
 	const LinearRing* lr = dynamic_cast<const LinearRing*>(ring);
-	ensure(lr);
+	ensure(0 != lr);
 
 	LinearRing* nclr = const_cast<LinearRing*>(lr);
 

Modified: trunk/tests/xmltester/XMLTester.cpp
===================================================================
--- trunk/tests/xmltester/XMLTester.cpp	2009-12-03 13:25:57 UTC (rev 2759)
+++ trunk/tests/xmltester/XMLTester.cpp	2009-12-03 14:48:08 UTC (rev 2760)
@@ -22,6 +22,7 @@
 //#include <stdlib.h>
 #  include <crtdbg.h>
 # endif
+#pragma warning(disable : 4127)
 #endif
 
 #include <geos/geom/Point.h>
@@ -604,7 +605,7 @@
 		geomAin = trimBlanks(geomAin);
 		gA = parseGeometry(geomAin, "Geometry A");
 
-		if ( (el = node->FirstChild("b")) )
+		if ( 0 != (el = node->FirstChild("b")) )
 		{
 			geomBin = el->FirstChild()->Value();
 			geomBin = trimBlanks(geomBin);
@@ -1140,7 +1141,7 @@
 
 		else if (opName=="iswithindistance")
 		{
-			float dist=std::atof(opArg3.c_str());
+			double dist=std::atof(opArg3.c_str());
 			if (gA->isWithinDistance(gB, dist)) {
 				actual_result="true";
 			} else {
@@ -1370,7 +1371,7 @@
 
 	if ((!success && verbose) || verbose > 1)
 	{
-		printTest(success, expected_result, actual_result);
+		printTest(!!success, expected_result, actual_result);
 	}
 
 	if (test_predicates && gB && gA) {



More information about the geos-commits mailing list