harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r425698 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
Date Wed, 26 Jul 2006 10:35:03 GMT
Author: pyang
Date: Wed Jul 26 03:35:03 2006
New Revision: 425698

URL: http://svn.apache.org/viewvc?rev=425698&view=rev
Log:
Fix for HARMONY-983 (Implementation of Character.reverseBytes & Character.isISOControl(int)
methods), the first commit missed the test codes

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java?rev=425698&r1=425697&r2=425698&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
Wed Jul 26 03:35:03 2006
@@ -216,6 +216,26 @@
 	}
 
 	/**
+	 * @tests java.lang.Character#isISOControl(int)
+	 */
+	public void test_isISOControlI() {
+		// Test for method boolean java.lang.Character.isISOControl(char)
+		for (int i = 0; i < 32; i++)
+			assertTrue("ISOConstrol char returned false", Character
+				.isISOControl(i));
+
+		for (int i = 127; i < 160; i++)
+			assertTrue("ISOConstrol char returned false", Character
+				.isISOControl(i));
+
+		for (int i = 160; i < 260; i++)
+			assertFalse("Not ISOConstrol char returned true", Character
+				.isISOControl(i));
+
+	}
+
+
+	/**
 	 * @tests java.lang.Character#isJavaIdentifierPart(char)
 	 */
 	public void test_isJavaIdentifierPartC() {
@@ -398,6 +418,25 @@
 		// Test for method boolean java.lang.Character.isWhitespace(char)
 		assertTrue("space returned false", Character.isWhitespace('\n'));
 		assertTrue("non-space returned true", !Character.isWhitespace('T'));
+	}
+
+	/**
+	 * @tests java.lang.Character#reverseBytes(char)
+	 */
+	public void test_reverseBytesC() {
+		char original[] = new char[]{0x0000, 0x0010, 0x00AA, 0xB000, 0xCC00, 0xABCD, 0xFFAA};
+		char reversed[] = new char[]{0x0000, 0x1000, 0xAA00, 0x00B0, 0x00CC, 0xCDAB, 0xAAFF};
+		assertTrue("Test self check", original.length==reversed.length);
+
+		for (int i=0; i<original.length; i++) {
+			char origChar = original[i];
+			char reversedChar = reversed[i];
+			char origReversed= Character.reverseBytes(origChar);
+
+			assertTrue("java.lang.Character.reverseBytes failed: orig char="
+				+Integer.toHexString(origChar)+", reversed char="
+				+Integer.toHexString(origReversed), reversedChar==origReversed);
+		}
 	}
 
 	/**



Mime
View raw message