Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 50397 invoked from network); 27 Dec 2005 05:06:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Dec 2005 05:06:02 -0000 Received: (qmail 68686 invoked by uid 500); 27 Dec 2005 05:05:59 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 68640 invoked by uid 500); 27 Dec 2005 05:05:59 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 68629 invoked by uid 500); 27 Dec 2005 05:05:59 -0000 Received: (qmail 68626 invoked by uid 99); 27 Dec 2005 05:05:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Dec 2005 21:05:58 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 26 Dec 2005 21:05:57 -0800 Received: (qmail 50222 invoked by uid 65534); 27 Dec 2005 05:05:37 -0000 Message-ID: <20051227050537.50219.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commons-cvs@jakarta.apache.org From: psteitz@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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