[geos-commits] r4014 - trunk/tests/xmltester

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Sep 19 06:50:40 PDT 2014


Author: strk
Date: 2014-09-19 06:50:40 -0700 (Fri, 19 Sep 2014)
New Revision: 4014

Modified:
   trunk/tests/xmltester/XMLTester.cpp
   trunk/tests/xmltester/XMLTester.h
Log:
Report time it took to run each test

Modified: trunk/tests/xmltester/XMLTester.cpp
===================================================================
--- trunk/tests/xmltester/XMLTester.cpp	2014-09-19 08:11:16 UTC (rev 4013)
+++ trunk/tests/xmltester/XMLTester.cpp	2014-09-19 13:50:40 UTC (rev 4014)
@@ -59,6 +59,7 @@
 #include <fstream>
 #include <functional>
 #include <iostream>
+#include <iomanip>
 #include <sstream>
 #include <cstring>
 #include <memory>
@@ -290,7 +291,7 @@
 
 /*private*/
 void
-XMLTester::printTest(bool success, const std::string& expected_result, const std::string& actual_result)
+XMLTester::printTest(bool success, const std::string& expected_result, const std::string& actual_result, const util::Profile &prof)
 {
     if ( sqlOutput )
     {
@@ -329,7 +330,8 @@
         std::cout << " case" << caseCount << ":";
         std::cout << " test" << testCount << ": "
             << opSignature; 
-        std::cout << ": " << (success?"ok.":"failed.")<<std::endl;
+        std::cout << ": " << (success?"ok.":"failed.");
+        std::cout << " (" << std::setprecision(15) << round(prof.getTot()/1000) << " ms)" << std::endl;
 
         std::cout << "\tDescription: " << curr_case_desc << std::endl;
 
@@ -749,11 +751,10 @@
     // if needed (geometry normalization, for example)
     std::string expected_result=opRes;
 
+    util::Profile profile("op");
+
     try
     {
-
-        util::Profile profile("op");
-
         if (opName=="relate")
         {
             std::auto_ptr<geom::IntersectionMatrix> im(gA->relate(gB));
@@ -785,12 +786,16 @@
             GeomAutoPtr gRes(parseGeometry(opRes, "expected"));
             gRes->normalize();
 
+            profile.start();
+
 #ifndef USE_BINARYOP
             GeomAutoPtr gRealRes(gA->intersection(gB));
 #else
             GeomAutoPtr gRealRes = BinaryOp(gA, gB, overlayOp(OverlayOp::opINTERSECTION));
 #endif
 
+            profile.stop();
+
             gRealRes->normalize();
 
             if (gRes->compareTo(gRealRes.get())==0) success=1;
@@ -1407,7 +1412,7 @@
 
     if ((!success && verbose) || verbose > 1)
     {
-        printTest(!!success, expected_result, actual_result);
+        printTest(!!success, expected_result, actual_result, profile);
     }
 
     if (test_predicates && gB && gA) {

Modified: trunk/tests/xmltester/XMLTester.h
===================================================================
--- trunk/tests/xmltester/XMLTester.h	2014-09-19 08:11:16 UTC (rev 4013)
+++ trunk/tests/xmltester/XMLTester.h	2014-09-19 13:50:40 UTC (rev 4014)
@@ -17,6 +17,7 @@
 
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/PrecisionModel.h>
+#include <geos/profiler.h>
 #include "tinyxml/tinyxml.h"
 
 using namespace geos;
@@ -43,7 +44,7 @@
 	static std::string trimBlanks(const std::string &in);
 	void printGeom(std::ostream& os, const geom::Geometry *g);
 	std::string printGeom(const geom::Geometry *g);
-	void printTest(bool success, const std::string& expected_result, const std::string& actual_result);
+	void printTest(bool success, const std::string& expected_result, const std::string& actual_result, const util::Profile&);
 
 	geom::Geometry *gA;
 	geom::Geometry *gB;



More information about the geos-commits mailing list