This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: StrictMath.cosh new test, cbrt update


This committed patch adds a new test and adds the ability to print the
expected values by running the main method of cbrt.java on the RI (the
other StrictMath tests already have this).

	Cheers,
		Carsten

2006-07-24  Carsten Neumann  <cn-develop@gmx.net>

	* gnu/testlet/java/lang/StrictMath/cosh.java: New test.
	* gnu/testlet/java/lang/StrictMath/cbrt.java
	(main): New method.
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1823
diff -u -r1.1823 ChangeLog
--- ChangeLog	24 Jul 2006 10:55:33 -0000	1.1823
+++ ChangeLog	24 Jul 2006 17:13:37 -0000
@@ -1,3 +1,9 @@
+2006-07-24  Carsten Neumann  <cn-develop@gmx.net>
+
+	* gnu/testlet/java/lang/StrictMath/cosh.java: New test.
+	* gnu/testlet/java/lang/StrictMath/cbrt.java
+	(main): New method.
+
 2006-07-24  Raif S. Naffah  <raif@swiftdsl.com.au>
 
 	* gnu/testlet/gnu/javax/crypto/jce/TestOfPR27228.java: New test.
Index: gnu/testlet/java/lang/StrictMath/cbrt.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/StrictMath/cbrt.java,v
retrieving revision 1.1
diff -u -r1.1 cbrt.java
--- gnu/testlet/java/lang/StrictMath/cbrt.java	20 Jul 2006 19:20:52 -0000	1.1
+++ gnu/testlet/java/lang/StrictMath/cbrt.java	24 Jul 2006 17:13:37 -0000
@@ -84,4 +84,19 @@
 	harness.check(res, outputValues[i]);
       }
   }
+
+  /**
+   * Run this on the RI to obtain the expected output values.
+   */
+  public static void main(String[] argv)
+  {
+    double res;
+
+    for (int i = 0; i < inputValues.length; ++i)
+      {
+	res = StrictMath.cbrt(inputValues[i]);
+
+	System.out.println(Double.toString(res));
+      }
+  }
 }
Index: gnu/testlet/java/lang/StrictMath/cosh.java
===================================================================
RCS file: gnu/testlet/java/lang/StrictMath/cosh.java
diff -N gnu/testlet/java/lang/StrictMath/cosh.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/lang/StrictMath/cosh.java	24 Jul 2006 17:13:37 -0000
@@ -0,0 +1,120 @@
+// Tags: JDK1.5
+
+//  Copyright (C) 2006 Carsten Neumann <cn-develop@gmx.net>
+
+//  This file is part of Mauve.
+
+//  Mauve is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2, or (at your option)
+//  any later version.
+
+//  Mauve is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+
+//  You should have received a copy of the GNU General Public License
+//  along with Mauve; see the file COPYING.  If not, write to
+//  the Free Software Foundation, 59 Temple Place - Suite 330,
+//  Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.lang.StrictMath;
+
+import gnu.testlet.Testlet;
+import gnu.testlet.TestHarness;
+
+public class cosh implements Testlet
+{
+  /**
+   * These values are used as arguments to cbrt.
+   * The values are somewhat arbitrary, but ensure that all code paths
+   * are tested.
+   */
+  private static double[] inputValues =
+    {
+      0.0,
+      Double.NaN,
+      Double.POSITIVE_INFINITY,
+      Double.NEGATIVE_INFINITY,
+      0.123456789,
+      -0.123456789,
+      0.234242656456,
+      -0.234242656456,
+      1.23456789,
+      -1.23456789,
+      9.87654321,
+      -9.87654321,
+      21.9999,
+      -21.9999,
+      567.891234,
+      -567.891234,
+      708.742342,
+      -708.742342,
+      709.7827128,
+      -709.7827128,
+      710.475860073943,
+      710.4755859375,
+      723.6787676346,
+      -723.6787676346,
+    };
+
+    /**
+   * These values are the expected results, obtained from the RI.
+   */
+  private static double[] outputValues =
+    {
+      1.0,
+      Double.NaN,
+      Double.POSITIVE_INFINITY,
+      Double.POSITIVE_INFINITY,
+      1.0076304736991977,
+      1.0076304736991977,
+      1.0275604855232756,
+      1.0275604855232756,
+      1.8639267730274125,
+      1.8639267730274125,
+      9734.154204183918,
+      9734.154204183918,
+      1.792277186385473e9,
+      1.792277186385473e9,
+      2.1428869091881118e246,
+      2.1428869091881118e246,
+      3.1758371607555525e307,
+      3.1758371607555525e307,
+      8.988464834932886e307,
+      8.988464834932886e307,
+      1.7976931348605396e308,
+      1.7972003892018829e308,
+      Double.POSITIVE_INFINITY,
+      Double.POSITIVE_INFINITY
+    };
+
+  public void test(TestHarness harness)
+  {
+    double res;
+
+    for (int i = 0; i < inputValues.length; ++i)
+      {
+	res = StrictMath.cosh(inputValues[i]);
+
+	// exact equality seems appropriate for StrictMath
+	harness.check(res, outputValues[i]);
+      }
+  }
+
+  /**
+   * Run this on the RI to obtain the expected output values.
+   */
+  public static void main(String[] argv)
+  {
+    double res;
+
+    for (int i = 0; i < inputValues.length; ++i)
+      {
+	res = StrictMath.cosh(inputValues[i]);
+
+	System.out.println(Double.toString(res));
+      }
+  }
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]