commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r359173 - /jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java
Date Tue, 27 Dec 2005 05:05:37 GMT
Author: psteitz
Date: Mon Dec 26 21:05:35 2005
New Revision: 359173

URL: http://svn.apache.org/viewcvs?rev=359173&view=rev
Log:
Javadoc.

Modified:
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java

Modified: jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java?rev=359173&r1=359172&r2=359173&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java (original)
+++ jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java Mon
Dec 26 21:05:35 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,12 +34,16 @@
  */
 public class TestUtils {
     /**
-     * 
+     * Collection of static methods used in math unit tests.
      */
     private TestUtils() {
         super();
     }
 
+    /**
+     * Verifies that expected and actual are within delta, or are both NaN or
+     * infinities of the same sign.
+     */
     public static void assertEquals(double expected, double actual, double delta) {
         assertEquals(null, expected, actual, delta);
     }
@@ -58,7 +62,7 @@
         }
     }
     
-    /*
+    /**
      * Verifies that the two arguments are exactly the same, either
      * both NaN or infinities of same sign, or identical floating point values.
      */
@@ -94,6 +98,13 @@
         }
     }
     
+    /**
+     * Serializes an object to a temp file and then recovers the object from the file.
+     * Returns the deserialized object.
+     * 
+     * @param o  object to serialize and recover
+     * @return  the recovered, deseriailized object
+     */
     public static Object serializeAndRecover(Object o){
         
         Object result = null;
@@ -140,9 +151,10 @@
     }
     
     /**
-     * Verifies that serialization preserves equals and hashCode
+     * Verifies that serialization preserves equals and hashCode.
+     * Serializes the object, then recovers it and checks equals and hash code.
      * 
-     * @param object
+     * @param object  the object to serialize and recover
      */
     public static void checkSerializedEquality(Object object) {
         Object object2 = serializeAndRecover(object);
@@ -150,11 +162,32 @@
         Assert.assertEquals("HashCode check", object.hashCode(), object2.hashCode());
     }
 
-    public static void assertRelativelyEquals(double expected, double actual, double relativeError)
{
+    /**
+     * Verifies that the relative error in actual vs. expected is less than or
+     * equal to relativeError.  If expected is infinite or NaN, actual must be
+     * the same (NaN or infinity of the same sign).
+     * 
+     * @param expected expected value
+     * @param actual  observed value
+     * @param relativeError  maximum allowable relative error
+     */
+    public static void assertRelativelyEquals(double expected, double actual,
+            double relativeError) {
         assertRelativelyEquals(null, expected, actual, relativeError);
     }
     
-    public static void assertRelativelyEquals(String msg, double expected, double actual,
double relativeError) {
+    /**
+     * Verifies that the relative error in actual vs. expected is less than or
+     * equal to relativeError.  If expected is infinite or NaN, actual must be
+     * the same (NaN or infinity of the same sign).
+     * 
+     * @param msg  message to return with failure
+     * @param expected expected value
+     * @param actual  observed value
+     * @param relativeError  maximum allowable relative error
+     */
+    public static void assertRelativelyEquals(String msg, double expected,
+            double actual, double relativeError) {
         if (Double.isNaN(expected)) {
             Assert.assertTrue(msg, Double.isNaN(actual));
         } else if (Double.isNaN(actual)) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message