harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r814698 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java
Date Mon, 14 Sep 2009 15:30:41 GMT
Author: tellison
Date: Mon Sep 14 15:30:41 2009
New Revision: 814698

URL: http://svn.apache.org/viewvc?rev=814698&view=rev
Log:
Additional tests in support of HARMONY-6339 ([classlib] [math] Sample test case showing Math
differences)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java?rev=814698&r1=814697&r2=814698&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java
Mon Sep 14 15:30:41 2009
@@ -245,9 +245,28 @@
      * @tests java.lang.Math#floor(double)
      */
     public void test_floorD() {
-        assertEquals("Incorrect floor for double", 78, Math.floor(78.89), 0);
-        assertEquals("Incorrect floor for double", -79, Math.floor(-78.89), 0);
-        assertEquals("floor large double", 3.7314645675925406E19, Math.floor(3.7314645675925406E19),0);
+        assertEquals("Incorrect floor for int", 42, Math.floor(42), 0);
+        assertEquals("Incorrect floor for -int", -2, Math.floor(-2), 0);
+        assertEquals("Incorrect floor for zero", 0d, Math.floor(0d), 0);
+
+        assertEquals("Incorrect floor for +double", 78, Math.floor(78.89), 0);
+        assertEquals("Incorrect floor for -double", -79, Math.floor(-78.89), 0);
+        assertEquals("floor large +double", 3.7314645675925406E19, Math.floor(3.7314645675925406E19),
0);
+        assertEquals("floor large -double", -8.173521839218E12, Math.floor(-8.173521839218E12),
0);
+        assertEquals("floor small double", 0.0d, Math.floor(1.11895241315E-102), 0);
+
+        // Compare toString representations here since -0.0 = +0.0, and
+        // NaN != NaN and we need to distinguish
+        assertEquals("Floor failed for NaN",
+                Double.toString(Double.NaN), Double.toString(Math.floor(Double.NaN)));
+        assertEquals("Floor failed for +0.0",
+                Double.toString(+0.0d), Double.toString(Math.floor(+0.0d)));
+        assertEquals("Floor failed for -0.0",
+                Double.toString(-0.0d), Double.toString(Math.floor(-0.0d)));
+        assertEquals("Floor failed for +infinity",
+                Double.toString(Double.POSITIVE_INFINITY), Double.toString(Math.floor(Double.POSITIVE_INFINITY)));
+        assertEquals("Floor failed for -infinity",
+                Double.toString(Double.NEGATIVE_INFINITY), Double.toString(Math.floor(Double.NEGATIVE_INFINITY)));
     }
     
     /**



Mime
View raw message