harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r446512 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/
Date Fri, 15 Sep 2006 04:25:41 GMT
Author: ndbeyer
Date: Thu Sep 14 21:25:40 2006
New Revision: 446512

URL: http://svn.apache.org/viewvc?view=rev&rev=446512
Log:
Cleanup compiler warnings and JUnit API usage.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/String2Test.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
Thu Sep 14 21:25:40 2006
@@ -15,90 +15,69 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class CompilerTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.Compiler#command(java.lang.Object)
-	 */
-	public void test_commandLjava_lang_Object() {
-		// Test for method java.lang.Object
-		// java.lang.Compiler.command(java.lang.Object)
-		try {
-			assertNull("Incorrect behavior.",
-					Compiler.command(new Object()));
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.lang.Compiler#compileClass(java.lang.Class)
-	 */
-	public void test_compileClassLjava_lang_Class() {
-		// Test for method boolean
-		// java.lang.Compiler.compileClass(java.lang.Class)
-		try {
-			// Do not test return value, may return true or false depending on
-			// if the jit is enabled. Make the call to ensure it doesn't crash.
-			Compiler.compileClass(Compiler.class);
-		} catch (Exception e) {
-			fail("Exception during test.");
-		}
-	}
-
-	/**
-	 * @tests java.lang.Compiler#compileClasses(java.lang.String)
-	 */
-	public void test_compileClassesLjava_lang_String() {
-		// Test for method boolean
-		// java.lang.Compiler.compileClasses(java.lang.String)
-		try {
-			// Do not test return value, may return true or false depending on
-			// if the jit is enabled. Make the call to ensure it doesn't crash.
-			Compiler.compileClasses("Compiler");
-		} catch (Exception e) {
-			fail("Exception during test.");
-		}
-	}
-
-	/**
-	 * @tests java.lang.Compiler#disable()
-	 */
-	public void test_disable() {
-		// Test for method void java.lang.Compiler.disable()
-		try {
-			Compiler.disable();
-			Compiler.compileClass(Compiler.class);
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * @tests java.lang.Compiler#enable()
-	 */
-	public void test_enable() {
-		// Test for method void java.lang.Compiler.enable()
-		try {
-			Compiler.disable();
-			Compiler.enable();
-			Compiler.compileClass(Compiler.class);
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+public class CompilerTest extends TestCase {
+
+    /**
+     * @tests java.lang.Compiler#command(java.lang.Object)
+     */
+    public void test_commandLjava_lang_Object() {
+        try {
+            assertNull("Incorrect behavior.", Compiler.command(new Object()));
+        } catch (Exception e) {
+            fail("Exception during test : " + e.getMessage());
+        }
+    }
+
+    /**
+     * @tests java.lang.Compiler#compileClass(java.lang.Class)
+     */
+    public void test_compileClassLjava_lang_Class() {
+        try {
+            // Do not test return value, may return true or false depending on
+            // if the jit is enabled. Make the call to ensure it doesn't crash.
+            Compiler.compileClass(Compiler.class);
+        } catch (Exception e) {
+            fail("Exception during test.");
+        }
+    }
+
+    /**
+     * @tests java.lang.Compiler#compileClasses(java.lang.String)
+     */
+    public void test_compileClassesLjava_lang_String() {
+        try {
+            // Do not test return value, may return true or false depending on
+            // if the jit is enabled. Make the call to ensure it doesn't crash.
+            Compiler.compileClasses("Compiler");
+        } catch (Exception e) {
+            fail("Exception during test.");
+        }
+    }
+
+    /**
+     * @tests java.lang.Compiler#disable()
+     */
+    public void test_disable() {
+        try {
+            Compiler.disable();
+            Compiler.compileClass(Compiler.class);
+        } catch (Exception e) {
+            fail("Exception during test : " + e.getMessage());
+        }
+    }
+
+    /**
+     * @tests java.lang.Compiler#enable()
+     */
+    public void test_enable() {
+        try {
+            Compiler.disable();
+            Compiler.enable();
+            Compiler.compileClass(Compiler.class);
+        } catch (Exception e) {
+            fail("Exception during test : " + e.getMessage());
+        }
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
Thu Sep 14 21:25:40 2006
@@ -15,10 +15,12 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import java.util.Locale;
+
 import junit.framework.TestCase;
 
 public class DoubleTest extends TestCase {
-    private static long rawBitsFor3_4en324ToN1[] = { 0x1L, 0x7L, 0x45L, 0x2b0L, 0x1ae2L,
+    private static final long rawBitsFor3_4en324ToN1[] = { 0x1L, 0x7L, 0x45L, 0x2b0L, 0x1ae2L,
             0x10cd1L, 0xa8028L, 0x69018dL, 0x41a0f7eL, 0x29049aedL, 0x19a2e0d44L,
             0x1005cc84acL, 0xa039fd2ebdL, 0x64243e3d361L, 0x3e96a6e641c6L, 0x271e284fe91b8L,
             0x1872d931f1b131L, 0x4e8f8f7e6e1d7dL, 0x8319b9af04d26eL, 0xb7e0281ac6070aL,
@@ -100,7 +102,7 @@
             0x3f364840e1719f80L, 0x3f6bda5119ce075fL, 0x3fa16872b020c49cL, 0x3fd5c28f5c28f5c3L,
             0x400B333333333333L };
 
-    private static long rawBitsFor1_2e0To309[] = { 0x3ff3333333333333L, 0x4028000000000000L,
+    private static final long rawBitsFor1_2e0To309[] = { 0x3ff3333333333333L, 0x4028000000000000L,
             0x405e000000000000L, 0x4092c00000000000L, 0x40c7700000000000L, 0x40fd4c0000000000L,
             0x41324f8000000000L, 0x4166e36000000000L, 0x419c9c3800000000L, 0x41d1e1a300000000L,
             0x42065a0bc0000000L, 0x423bf08eb0000000L, 0x427176592e000000L, 0x42a5d3ef79800000L,
@@ -179,12 +181,6 @@
             0x7ea665f8bf806e42L, 0x7edbff76ef6089d2L, 0x7f117faa559c5623L, 0x7f45df94eb036bacL,
             0x7f7b577a25c44697L, 0x7fb116ac579aac1fL, 0x7fe55c576d815726L, 0x7ff0000000000000L
};
 
-    private static String toHex(long l) {
-        return Long.toHexString(l);
-    }
-
-    private boolean pass = true;
-
     private void doTestCompareRawBits(String originalDoubleString, long expectedRawBits,
             String expectedString) {
         double result;
@@ -193,63 +189,34 @@
         result = Double.parseDouble(originalDoubleString);
         rawBits = Double.doubleToLongBits(result);
         convertedString = new Double(result).toString();
-        if (expectedRawBits != rawBits) {
-            pass = false;
-            System.out.println("Original double(" + originalDoubleString
-                    + ") Converted double(" + result + ") Expecting:" + toHex(expectedRawBits)
-                    + " Got: " + toHex(rawBits));
-        }
-        if (!convertedString.equalsIgnoreCase(expectedString)) {
-            pass = false;
-            System.out.println("Expecting(" + expectedString + ") Got(" + convertedString
-                    + ") rawBits(" + toHex(Double.doubleToLongBits(result)) + ")");
-        }
+        assertEquals(expectedRawBits, rawBits);
+        assertEquals(expectedString.toLowerCase(Locale.US), convertedString
+                .toLowerCase(Locale.US));
     }
 
     private void test_toString(double dd, String answer) {
-        // Test for method java.lang.String java.lang.Double.toString(double)
-        if (!Double.toString(dd).equals(answer)) {
-            System.out.println("Incorrect String representation "
-                    + toHex(Double.doubleToLongBits(dd)) + " want " + answer + ", got ("
-                    + Double.toString(dd) + ")");
-            pass = false;
-        } else {
-            Double d = new Double(dd);
-            if (!Double.toString(d.doubleValue()).equals(answer)) {
-                System.out.println("Incorrect String representation want " + answer + ",
got ("
-                        + Double.toString(d.doubleValue()) + ")");
-                pass = false;
-            } else if (!d.toString().equals(answer)) {
-                System.out.println("Incorrect String representation want " + answer + ",
got ("
-                        + d.toString() + ")");
-                pass = false;
-            }
-        }
-    }
-
-    private void verifyStaticTests() {
-        assertTrue("test(s) failed, check test output", pass);
+        assertEquals(answer, Double.toString(dd));
+        Double d = new Double(dd);
+        assertEquals(answer, Double.toString(d.doubleValue()));
+        assertEquals(answer, d.toString());
     }
 
     /**
      * @tests java.lang.Double#Double(double)
      */
     public void test_ConstructorD() {
-        // Test for method java.lang.Double(double)
         Double d = new Double(39089.88888888888888888888888888888888);
         assertEquals("Created incorrect double", 39089.88888888888888888888888888888888,
d
-                .doubleValue());
+                .doubleValue(), 0D);
     }
 
     /**
      * @tests java.lang.Double#Double(java.lang.String)
      */
     public void test_ConstructorLjava_lang_String() {
-        // Test for method java.lang.Double(java.lang.String)
-
         Double d = new Double("39089.88888888888888888888888888888888");
         assertEquals("Created incorrect double", 39089.88888888888888888888888888888888,
d
-                .doubleValue());
+                .doubleValue(), 0D);
 
         // REGRESSION for HARMONY-489
         try {
@@ -264,9 +231,8 @@
      * @tests java.lang.Double#byteValue()
      */
     public void test_byteValue() {
-        // Test for method byte java.lang.Double.byteValue()
         Double d = new Double(1923311.47712);
-        assertTrue("Returned incorrect byte value", d.byteValue() == (byte) -17);
+        assertEquals("Returned incorrect byte value", (byte) -17, d.byteValue());
     }
 
     /**
@@ -328,9 +294,8 @@
      * @tests java.lang.Double#doubleValue()
      */
     public void test_doubleValue() {
-        // Test for method double java.lang.Double.doubleValue()
         assertEquals("Incorrect double value returned", 999999999999999.9999999999999,
-                new Double(999999999999999.9999999999999).doubleValue());
+                new Double(999999999999999.9999999999999).doubleValue(), 0D);
     }
 
     /**
@@ -350,8 +315,8 @@
     public void test_hashCode() {
         // Test for method int java.lang.Double.hashCode()
         for (int i = -1000; i < 1000; i++) {
-            Double d = new Double((double) i);
-            Double dd = new Double((double) i);
+            Double d = new Double(i);
+            Double dd = new Double(i);
             assertTrue("Should not be identical ", d != dd);
             assertTrue("Should be equals 1 ", d.equals(dd));
             assertTrue("Should be equals 2 ", dd.equals(d));
@@ -586,8 +551,6 @@
         doTestCompareRawBits(
                 "-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055595409854908458349204328908234982349050934129878452378432452458968024357823490509341298784523784324524589680243578234905093412987845237843245245896802435782349050934129878452378432452458968024357868024357823490509341298784523784324524589680243578234905093412987845237843245245896802435786802435782349050934129878452378432452458968024357823490509341298784523784324524589680243578",
                 0x8000000000000001L, "-4.9E-324");
-
-        verifyStaticTests();
     }
 
     /**
@@ -606,7 +569,6 @@
         // Test for method java.lang.String java.lang.Double.toString()
         test_toString(1.7976931348623157E308, "1.7976931348623157E308");
         test_toString(5.0E-4, "5.0E-4");
-        verifyStaticTests();
     }
 
     /**
@@ -694,8 +656,6 @@
         test_toString(d, "-3.3846065602060826E125");
         d = Double.longBitsToDouble(0xda0000000000000eL);
         test_toString(d, "-3.384606560206083E125");
-
-        verifyStaticTests();
     }
 
     /**
@@ -724,6 +684,7 @@
         }
 
         Double pi = Double.valueOf("3.141592654");
+        assertEquals(3.141592654, pi.doubleValue(), 0D);
 
         Double posZero = Double.valueOf("+0.0");
         Double negZero = Double.valueOf("-0.0");
@@ -821,7 +782,7 @@
      * @tests java.lang.Double#toHexString(double)
      */
     public void test_toHexStringF() {
-        //the follow values come from the Double Javadoc/Spec
+        // the follow values come from the Double Javadoc/Spec
         assertEquals("0x0.0p0", Double.toHexString(0.0D));
         assertEquals("-0x0.0p0", Double.toHexString(-0.0D));
         assertEquals("0x1.0p0", Double.toHexString(1.0D));
@@ -833,12 +794,12 @@
         assertEquals("0x1.fffffffffffffp1023", Double.toHexString(Double.MAX_VALUE));
         assertEquals("0x0.0000000000001p-1022", Double.toHexString(Double.MIN_VALUE));
 
-        //test edge cases
+        // test edge cases
         assertEquals("NaN", Double.toHexString(Double.NaN));
         assertEquals("-Infinity", Double.toHexString(Double.NEGATIVE_INFINITY));
         assertEquals("Infinity", Double.toHexString(Double.POSITIVE_INFINITY));
 
-        //test various numbers
+        // test various numbers
         assertEquals("-0x1.da8p6", Double.toHexString(-118.625D));
         assertEquals("0x1.2957874cccccdp23", Double.toHexString(9743299.65D));
         assertEquals("0x1.2957874cccccdp23", Double.toHexString(9743299.65000D));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
Thu Sep 14 21:25:40 2006
@@ -15,15 +15,11 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-import java.util.Vector;
-
 import junit.framework.TestCase;
 
 public class FloatTest extends TestCase {
 
-    private Vector compareResults;
-
-    private static int rawBitsFor3_4eN38To38[] = { 0x1394470, 0x2e7958c, 0x490bd77, 0x634ecd5,
+    private static final int rawBitsFor3_4eN38To38[] = { 0x1394470, 0x2e7958c, 0x490bd77,
0x634ecd5,
             0x7e2280b, 0x98d5907, 0xb30af48, 0xcdcdb1a, 0xe8a08f0, 0x102c8b2d, 0x11d7adf8,
             0x1386ccbb, 0x15287fe9, 0x16d29fe4, 0x1883a3ee, 0x1a248cea, 0x1bcdb025, 0x1d808e17,
             0x1f20b19d, 0x20c8de04, 0x227b1585, 0x241ced73, 0x25c428d0, 0x27753303, 0x29193fe2,
@@ -36,7 +32,7 @@
             0x7089705f, 0x722bcc76, 0x73d6bf94, 0x758637bc, 0x7727c5ac, 0x78d1b717, 0x7a83126e,
             0x7c23d70a, 0x7dcccccc, 0x7f7fffff };
 
-    private static String expectedStringFor3_4eN38To38[] = { "3.4028235E-38", "3.4028235E-37",
+    private static final String expectedStringFor3_4eN38To38[] = { "3.4028235E-38", "3.4028235E-37",
             "3.4028233E-36", "3.4028234E-35", "3.4028236E-34", "3.4028236E-33",
             "3.4028234E-32", "3.4028234E-31", "3.4028233E-30", "3.4028236E-29",
             "3.4028235E-28", "3.4028235E-27", "3.4028233E-26", "3.4028235E-25",
@@ -54,7 +50,7 @@
             "3.4028236E29", "3.4028233E30", "3.4028235E31", "3.4028233E32", "3.4028236E33",
             "3.4028236E34", "3.4028234E35", "3.4028236E36", "3.4028235E37", "3.4028235E38"
};
 
-    private static int rawBitsFor1_17eN38To38[] = { 0x80800000, 0x82200000, 0x83c80000,
+    private static final int rawBitsFor1_17eN38To38[] = { 0x80800000, 0x82200000, 0x83c80000,
             0x857a0000, 0x871c4000, 0x88c35000, 0x8a742400, 0x8c189680, 0x8dbebc20, 0x8f6e6b28,
             0x911502f9, 0x92ba43b7, 0x9468d4a5, 0x961184e7, 0x97b5e621, 0x99635fa9, 0x9b0e1bca,
             0x9cb1a2bc, 0x9e5e0b6b, 0xa00ac723, 0xa1ad78ec, 0xa358d727, 0xa5078678, 0xa6a96816,
@@ -67,7 +63,7 @@
             0xee17edd8, 0xefbde94f, 0xf16d63a2, 0xf3145e45, 0xf4b975d7, 0xf667d34c, 0xf810e410,
             0xf9b51d14, 0xfb626459, 0xfd0d7eb7, 0xfeb0de65 };
 
-    private static String expectedStringFor1_17eN38To38[] = { "-1.17549435E-38",
+    private static final String expectedStringFor1_17eN38To38[] = { "-1.17549435E-38",
             "-1.1754944E-37", "-1.17549435E-36", "-1.17549435E-35", "-1.1754944E-34",
             "-1.17549435E-33", "-1.17549435E-32", "-1.1754944E-31", "-1.17549435E-30",
             "-1.17549435E-29", "-1.1754944E-28", "-1.1754943E-27", "-1.17549435E-26",
@@ -87,25 +83,14 @@
             "-1.1754943E31", "-1.1754944E32", "-1.1754943E33", "-1.1754944E34",
             "-1.1754944E35", "-1.1754944E36", "-1.1754943E37", "-1.1754943E38" };
 
-    private static String toHex(int i) {
-        return Integer.toHexString(i);
-    }
-
     private void doTestCompareRawBits(String originalFloatString, int expectedRawBits,
             String expectedString) {
         int rawBits;
-        String convertedString;
         float result = Float.parseFloat(originalFloatString);
         rawBits = Float.floatToIntBits(result);
-        convertedString = Float.toString(result);
-        if (expectedRawBits != rawBits) {
-            if (compareResults == null) {
-                compareResults = new Vector();
-            }
-            compareResults.addElement("Original float(" + originalFloatString
-                    + ") Converted float(" + result + ") Expecting:" + toHex(expectedRawBits)
-                    + " Got: " + toHex(rawBits));
-        }
+        assertEquals("Original float(" + originalFloatString + ") Converted float(" + result
+                + ") Expecting:" + Integer.toHexString(expectedRawBits) + " Got: "
+                + Integer.toHexString(rawBits), expectedRawBits, rawBits);
     }
 
     /**
@@ -185,8 +170,6 @@
      * @tests java.lang.Float#floatToIntBits(float)
      */
     public void test_floatToIntBitsF() {
-        // Test for method int java.lang.Float.floatToIntBits(float)
-        // TODO : Enhance test ??
         float f = 9876.2345f;
         int bits = Float.floatToIntBits(f);
         float r = Float.intBitsToFloat(bits);
@@ -236,12 +219,10 @@
      * @tests java.lang.Float#intBitsToFloat(int)
      */
     public void test_intBitsToFloatI() {
-        // Test for method float java.lang.Float.intBitsToFloat(int)
-        // TODO : Enhance test ??
         float f = 9876.2345f;
         int bits = Float.floatToIntBits(f);
         float r = Float.intBitsToFloat(bits);
-        assertTrue("Incorrect intBits returned", f == r);
+        assertEquals("Incorrect intBits returned", f, r, 0F);
     }
 
     /**
@@ -259,7 +240,7 @@
      */
     public void test_isInfinite() {
         // Test for method boolean java.lang.Float.isInfinite()
-        assertTrue("Ininifty check failed",
+        assertTrue("Infinity check failed",
                 (new Float(Float.POSITIVE_INFINITY).isInfinite() && new Float(
                         Float.NEGATIVE_INFINITY).isInfinite())
                         && !(new Float(0.13131414f).isInfinite()));
@@ -320,8 +301,8 @@
 
         /* Test a set of regular floats with exponents from -38 to +38 */
         for (int i = 38; i > 3; i--) {
-            String testString, expectedString;
-            testString = expectedString = "3.4028234663852886e-" + i;
+            String testString;
+            testString = "3.4028234663852886e-" + i;
             doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 - i],
                     expectedStringFor3_4eN38To38[38 - i]);
         }
@@ -347,16 +328,16 @@
                 expectedStringFor3_4eN38To38[38 + 6]);
 
         for (int i = 7; i < 39; i++) {
-            String testString, expectedString;
-            testString = expectedString = "3.4028234663852886e+" + i;
+            String testString;
+            testString = "3.4028234663852886e+" + i;
             doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 + i],
                     expectedStringFor3_4eN38To38[38 + i]);
         }
 
         /* Test another set of regular floats with exponents from -38 to +38 */
         for (int i = 38; i > 3; i--) {
-            String testString, expectedString;
-            testString = expectedString = "-1.1754943508222875e-" + i;
+            String testString;
+            testString = "-1.1754943508222875e-" + i;
             doTestCompareRawBits(testString, rawBitsFor1_17eN38To38[38 - i],
                     expectedStringFor1_17eN38To38[38 - i]);
         }
@@ -382,8 +363,8 @@
                 expectedStringFor1_17eN38To38[38 + 6]);
 
         for (int i = 7; i < 39; i++) {
-            String testString, expectedString;
-            testString = expectedString = "-1.1754943508222875e+" + i;
+            String testString;
+            testString = "-1.1754943508222875e+" + i;
             doTestCompareRawBits(testString, rawBitsFor1_17eN38To38[38 + i],
                     expectedStringFor1_17eN38To38[38 + i]);
         }
@@ -420,15 +401,6 @@
         doTestCompareRawBits("-3.42E+38", 0xff800000, "-Infinity");
         doTestCompareRawBits("1.0E+39", 0x7f800000, "Infinity");
         doTestCompareRawBits("-1.0E+39", 0xff800000, "-Infinity");
-
-        if (compareResults != null) {
-            StringBuffer failString = new StringBuffer();
-            for (int i = 0; i < compareResults.size(); i++) {
-                failString.append(compareResults.elementAt(i));
-                failString.append("\n");
-            }
-            fail(failString.toString());
-        }
     }
 
     /**
@@ -471,8 +443,6 @@
         answer = "3.4028235E38";
         assertTrue("Incorrect String representation want " + answer + ", got "
                 + Float.toString(ff), Float.toString(ff).equals(answer));
-        // TODO : There is a known problem with floating point printing. So
-        // this is not included
     }
 
     /**
@@ -565,7 +535,8 @@
         for (int i = 0; i < values.length; i++) {
             float f1 = values[i];
 
-            // Test that each value compares equal to itself; and each object is equal to
another object
+            // Test that each value compares equal to itself; and each object is
+            // equal to another object
             // like itself
             assertTrue("Assert 0: compare() should be equal: " + f1, Float.compare(f1, f1)
== 0);
             Float objFloat = new Float(f1);
@@ -621,7 +592,7 @@
      * @tests java.lang.Float#toHexString(float)
      */
     public void test_toHexStringF() {
-        //the follow values comes from the Float Javadoc/Spec
+        // the follow values comes from the Float Javadoc/Spec
         assertEquals("0x0.0p0", Float.toHexString(0.0F));
         assertEquals("-0x0.0p0", Float.toHexString(-0.0F));
         assertEquals("0x1.0p0", Float.toHexString(1.0F));
@@ -633,12 +604,12 @@
         assertEquals("0x1.fffffep127", Float.toHexString(Float.MAX_VALUE));
         assertEquals("0x0.000002p-126", Float.toHexString(Float.MIN_VALUE));
 
-        //test edge cases
+        // test edge cases
         assertEquals("NaN", Float.toHexString(Float.NaN));
         assertEquals("-Infinity", Float.toHexString(Float.NEGATIVE_INFINITY));
         assertEquals("Infinity", Float.toHexString(Float.POSITIVE_INFINITY));
 
-        //test various numbers
+        // test various numbers
         assertEquals("-0x1.da8p6", Float.toHexString(-118.625F));
         assertEquals("0x1.295788p23", Float.toHexString(9743299.65F));
         assertEquals("0x1.295788p23", Float.toHexString(9743299.65000F));

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java
Thu Sep 14 21:25:40 2006
@@ -15,30 +15,25 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class InheritableThreadLocalTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
+
+public class InheritableThreadLocalTest extends TestCase {
 
 	/**
 	 * @tests java.lang.InheritableThreadLocal#InheritableThreadLocal()
 	 */
 	public void test_Constructor() {
-		// Test for method java.lang.InheritableThreadLocal()
-
-		InheritableThreadLocal l = new InheritableThreadLocal();
-		assertTrue("Failed to create InheritableThreadLocal",
-				l instanceof InheritableThreadLocal);
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
+	    InheritableThreadLocal<String> itl = new InheritableThreadLocal<String>();
+        assertNull(itl.get());
 	}
+    
+    public void test_initialValue() {
+        InheritableThreadLocal<String> itl = new InheritableThreadLocal<String>()
{
+            @Override
+            protected String initialValue() {
+                return "initial";
+            }
+        };
+        assertEquals("initial", itl.get());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java
Thu Sep 14 21:25:40 2006
@@ -22,10 +22,12 @@
 public class IntegerTest extends TestCase {
     private Properties orgProps;
     
+    @Override
     protected void setUp() {
         orgProps = System.getProperties();
     }
 
+    @Override
     protected void tearDown() {
         System.setProperties(orgProps);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java
Thu Sep 14 21:25:40 2006
@@ -22,10 +22,12 @@
 public class LongTest extends TestCase {
     private Properties orgProps;
     
+    @Override
     protected void setUp() {
         orgProps = System.getProperties();
     }
 
+    @Override
     protected void tearDown() {
         System.setProperties(orgProps);
     }
@@ -1028,11 +1030,11 @@
      */
     public void test_signumJ() {
         for (int i = -128; i<0; i++) {
-            assertEquals(-1, Long.signum((long)i));
+            assertEquals(-1, Long.signum(i));
         }
-        assertEquals(0, Long.signum((long)0));
+        assertEquals(0, Long.signum(0));
         for (int i = 1; i<=127; i++) {
-            assertEquals(1, Long.signum((long)i));
+            assertEquals(1, Long.signum(i));
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
Thu Sep 14 21:25:40 2006
@@ -143,13 +143,6 @@
         assertEquals("Should return 1.7031839360032603E-108",
                 1.7031839360032603E-108, Math.cbrt(Double.MIN_VALUE), 0D);
         assertEquals("Should return -0.01", -0.01, Math.cbrt(-0.000001), 0D);
-        
-        try{
-            Math.cbrt((Double)null);
-            fail("Should throw NullPointerException");
-        }catch(NullPointerException e){
-            //expected
-        }
     }
 
 	/**
@@ -730,19 +723,4 @@
 		assertEquals("Returned incorrect value", 5.6E-45f, Math
 				.ulp(9.403954E-38f), 0f);
     }
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
Thu Sep 14 21:25:40 2006
@@ -787,19 +787,4 @@
 		assertEquals("Returned incorrect value", 5.6E-45f, Math
 				.ulp(9.403954E-38f), 0f);
     }
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/String2Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/String2Test.java?view=diff&rev=446512&r1=446511&r2=446512
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/String2Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/String2Test.java
Thu Sep 14 21:25:40 2006
@@ -893,7 +893,8 @@
 	/**
 	 * @tests java.lang.String#format(Locale, String, Object[])
 	 */	
-	public void test_format() {
+	@SuppressWarnings("boxing")
+    public void test_format() {
 	    assertEquals("13% of sum is 0x11", 
 		    String.format("%d%% of %s is 0x%x", 13, "sum", 17));
 	    assertEquals("empty format", "", String.format("", 123, this));



Mime
View raw message