Author: alanmc
Date: 2006-12-24 13:49:42 -0500 (Sun, 24 Dec 2006)
New Revision: 70028

Modified:
   trunk/Mono.Xna/tests/TestHelper.cs
Log:
Added comments and niced up a little.

Modified: trunk/Mono.Xna/tests/TestHelper.cs
===================================================================
--- trunk/Mono.Xna/tests/TestHelper.cs  2006-12-24 18:45:43 UTC (rev 70027)
+++ trunk/Mono.Xna/tests/TestHelper.cs  2006-12-24 18:49:42 UTC (rev 70028)
@@ -6,6 +6,12 @@
 {
     public static class TestHelper
     {
+        /// <summary>
+        /// Used to check if two floating point values are approximately the 
same.
+        /// </summary>
+        /// <param name="value1">First value to compare</param>
+        /// <param name="value2">Second value to compare</param>
+        /// <returns></returns>
         public static bool ApproximatelyEquals(float value1, float value2)
         {
             float epsilon = 1 / 100000.0f;
@@ -16,14 +22,11 @@
 
         public static bool ApproximatelyEquals(float? value1, float? value2)
         {
-            if (value1 == null && value2 == null)
-                return true;
-            if (value1 == null && value2 != null)
-                return false;
-            if (value2 == null && value1 != null)
-                return false;
+            if (value1 == null)
+                return value2 == null;
 
-            
+            if (value2 == null)
+                return value1 == null;
 
             float epsilon = 1 / 100000.0f;
             Console.WriteLine(Math.Abs((float)value1) + " - " + 
Math.Abs((float)value2) + " = " + Math.Abs(Math.Abs((float)value1) - 
Math.Abs((float)value2)));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to