sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1487436 - in /sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis: test/TestUtilities.java util/NumbersTest.java
Date Wed, 29 May 2013 10:41:48 GMT
Author: desruisseaux
Date: Wed May 29 10:41:48 2013
New Revision: 1487436

URL: http://svn.apache.org/r1487436
Log:
Uses only StrictMath in tests, as a matter of principle.

Modified:
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1487436&r1=1487435&r2=1487436&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
[UTF-8] Wed May 29 10:41:48 2013
@@ -138,7 +138,7 @@ public final strictfp class TestUtilitie
      * @return A new random number generator initialized with a random seed.
      */
     public static Random createRandomNumberGenerator(final String testMethod) {
-        final long seed = Math.round(Math.random() * (1L << 48));
+        final long seed = StrictMath.round(StrictMath.random() * (1L << 48));
         final PrintWriter out = TestCase.out;
         out.print("Random number generator for “");
         out.print(testMethod);

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java?rev=1487436&r1=1487435&r2=1487436&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
[UTF-8] Wed May 29 10:41:48 2013
@@ -161,7 +161,7 @@ public final class NumbersTest extends T
         assertEquals(Integer.class, narrowestClass(-100000  ));
         assertEquals(Integer.class, narrowestClass((double) (1L << 30)));
         assertEquals(Float  .class, narrowestClass((double) (1L << 40)));
-        assertEquals(Double .class, narrowestClass(Math.PI));
+        assertEquals(Double .class, narrowestClass(StrictMath.PI));
     }
 
     /**
@@ -169,16 +169,16 @@ public final class NumbersTest extends T
      */
     @Test
     public void testNarrowestNumber() {
-        assertEquals(Byte   .valueOf((byte)   127), narrowestNumber(    127.0));
-        assertEquals(Short  .valueOf((short)  128), narrowestNumber(    128.0));
-        assertEquals(Integer.valueOf(      100000), narrowestNumber( 100000.0));
-        assertEquals(Float  .valueOf(       10.5f), narrowestNumber(     10.5));
-        assertEquals(Byte   .valueOf((byte)  -128), narrowestNumber(   -128  ));
-        assertEquals(Short  .valueOf((short) -129), narrowestNumber(   -129  ));
-        assertEquals(Integer.valueOf(     -100000), narrowestNumber(-100000  ));
-        assertEquals(Integer.valueOf(1  << 30),     narrowestNumber((double) (1L <<
30)));
-        assertEquals(Float  .valueOf(1L << 40),     narrowestNumber((double) (1L <<
40)));
-        assertEquals(Double .valueOf(Math.PI),      narrowestNumber(Math.PI));
+        assertEquals(Byte   .valueOf((byte)   127),  narrowestNumber(    127.0));
+        assertEquals(Short  .valueOf((short)  128),  narrowestNumber(    128.0));
+        assertEquals(Integer.valueOf(      100000),  narrowestNumber( 100000.0));
+        assertEquals(Float  .valueOf(       10.5f),  narrowestNumber(     10.5));
+        assertEquals(Byte   .valueOf((byte)  -128),  narrowestNumber(   -128  ));
+        assertEquals(Short  .valueOf((short) -129),  narrowestNumber(   -129  ));
+        assertEquals(Integer.valueOf(     -100000),  narrowestNumber(-100000  ));
+        assertEquals(Integer.valueOf(1  << 30),      narrowestNumber((double) (1L <<
30)));
+        assertEquals(Float  .valueOf(1L << 40),      narrowestNumber((double) (1L <<
40)));
+        assertEquals(Double .valueOf(StrictMath.PI), narrowestNumber(StrictMath.PI));
     }
 
     /**



Mime
View raw message