[mapguide-commits] r1212 - trunk/MgDev/Common/Foundation/System

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Mar 13 16:05:54 EDT 2007


Author: brucedechant
Date: 2007-03-13 16:05:53 -0400 (Tue, 13 Mar 2007)
New Revision: 1212

Modified:
   trunk/MgDev/Common/Foundation/System/Util.cpp
   trunk/MgDev/Common/Foundation/System/Util.h
Log:
Updated ValuesEqual method to display failure details for both release and debug builds if needed via an optional parameter.
Note: This method is only used by the unit tests.


Modified: trunk/MgDev/Common/Foundation/System/Util.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/System/Util.cpp	2007-03-13 19:28:04 UTC (rev 1211)
+++ trunk/MgDev/Common/Foundation/System/Util.cpp	2007-03-13 20:05:53 UTC (rev 1212)
@@ -942,7 +942,7 @@
     str = &buf[0];
 }
 
-bool MgUtil::ValuesEqual(double value1, double value2, double tolerance)
+bool MgUtil::ValuesEqual(double value1, double value2, double tolerance, bool output)
 {
     bool valuesEqual = true;
     double difference = value1 - value2;
@@ -956,7 +956,10 @@
         if (::fabs(error) > ::fabs(tolerance))
         {
             // If the values don't match and don't fall within the tolerance, then output them.
-            ACE_DEBUG((LM_DEBUG, ACE_TEXT("\nMgUtil.ValuesEqual() failed!\nOriginal: \"%.17g\"\nCalculated: \"%.17g\"\n"), value1, value2));
+            if(output)
+            {
+                ACE_DEBUG((LM_INFO, ACE_TEXT("\nMgUtil.ValuesEqual() failed!\nOriginal: \"%.17g\"\nCalculated: \"%.17g\"\n"), value1, value2));
+            }
             valuesEqual = false;
         }
     }

Modified: trunk/MgDev/Common/Foundation/System/Util.h
===================================================================
--- trunk/MgDev/Common/Foundation/System/Util.h	2007-03-13 19:28:04 UTC (rev 1211)
+++ trunk/MgDev/Common/Foundation/System/Util.h	2007-03-13 20:05:53 UTC (rev 1212)
@@ -502,7 +502,8 @@
     static void DoubleToString(double val, STRING& str);
 
     static bool ValuesEqual(double value1, double value2,
-        double tolerance = MgUtil::DefaultCompareTolerance);
+        double tolerance = MgUtil::DefaultCompareTolerance,
+        bool output = true);
 
     static void TrimEndingZeros(string& str);
     static void TrimEndingZeros(STRING& str);



More information about the mapguide-commits mailing list