diff options
Diffstat (limited to 'libjava/classpath/testsuite')
65 files changed, 0 insertions, 5493 deletions
diff --git a/libjava/classpath/testsuite/config/tests b/libjava/classpath/testsuite/config/tests deleted file mode 100644 index 6b14bb0..0000000 --- a/libjava/classpath/testsuite/config/tests +++ /dev/null @@ -1,22 +0,0 @@ -ByteTest$constructorTest1 -ByteTest$constructorTest2 -ByteTest$byteValueTest -ByteTest$decodeTest -ByteTest$doubleValueTest -ByteTest$equalsTest1 -ByteTest$equalsTest2 -ByteTest$floatValueTest -ByteTest$hashCodeTest -ByteTest$intValueTest -ByteTest$longValueTest -ByteTest$parseByteTest1 -ByteTest$parseByteTest2 -ByteTest$shortValueTest -ByteTest$toStringTest1 -ByteTest$toStringTest2 -ByteTest$valueOfTest1 -ByteTest$valueOfTest2 -ByteTest$variablesTest1 -ByteTest$variablesTest2 -ByteTest$variablesTest3 -ByteTest$typeInstance diff --git a/libjava/classpath/testsuite/java.io/IsAbsoluteTest.java b/libjava/classpath/testsuite/java.io/IsAbsoluteTest.java deleted file mode 100644 index 2e4a650..0000000 --- a/libjava/classpath/testsuite/java.io/IsAbsoluteTest.java +++ /dev/null @@ -1,26 +0,0 @@ -import java.io.*; - -public class IsAbsoluteTest { - public static void main (String args[]) { - try { - File f1 = new File("/etc/passwd"); - File f2 = new File("\\autoexec.bat"); - File f3 = new File("c:\\autoexec.bat"); - - File u1 = new File("tmp/somefile"); - - if ( u1.isAbsolute() ) - throw new Exception("Claims "+u1+" is absolute!"); - - if ( ! f1.isAbsolute() ) - { /* Hm, might be on MSDOS platform, test those cases */ - if ( ! f2.isAbsolute() || ! f3.isAbsolute() ) - throw new Exception("Claims file isn't absolute!"); - } - - System.out.println("PASSED: All ok"); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.io/RandomAccessFileTest.java b/libjava/classpath/testsuite/java.io/RandomAccessFileTest.java deleted file mode 100644 index 69dc438..0000000 --- a/libjava/classpath/testsuite/java.io/RandomAccessFileTest.java +++ /dev/null @@ -1,50 +0,0 @@ - -import java.io.*; - -public class RandomAccessFileTest { - public static void main (String args[]) { - try { - File f = new File("/etc/passwd"); - RandomAccessFile rf = new RandomAccessFile(f,"r"); - - long length = rf.length(); - - rf.seek(length - 10); - long pos = rf.getFilePointer(); - - if ( (length - 10) != pos ) - throw new Exception("Bad value from getFilePointer(), " + - pos + " !=" + (length - 10)); - - int i = rf.read(); - byte b = rf.readByte(); - boolean test = rf.readBoolean(); - - byte buf[] = new byte[40]; - rf.seek(0); - rf.read(buf); - - rf.close(); - try { - length = rf.length(); - throw new Exception("Got length from closed RandomAccessFile()."); - } catch (IOException e) {} - - String filename2 = "/var/tmp/testfile-remove"; - - File f2 = new File(filename2); - RandomAccessFile rf2 = new RandomAccessFile(filename2, "rw"); - - rf2.write(100); - rf2.write(buf); - - rf2.close(); - f2.delete(); - - System.out.println("PASSED: RandomAccessFile worked."); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.io/execute.exp b/libjava/classpath/testsuite/java.io/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.io/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.lang/ArrayTest.java b/libjava/classpath/testsuite/java.lang/ArrayTest.java deleted file mode 100644 index 36eaff4..0000000 --- a/libjava/classpath/testsuite/java.lang/ArrayTest.java +++ /dev/null @@ -1,100 +0,0 @@ - -public class ArrayTest { - public static void main (String args[]) - { - BooleanArrayInit(); - ByteArrayInit(); - CharArrayInit(); - ShortArrayInit(); - IntArrayInit(); - ArrayName(args); - } - public static void BooleanArrayInit() - { - try { - boolean val = true; - boolean [] x = { true }; - if (x[0] == val) - passed("BooleanArrayInit() boolean[] x = {"+val+"}"); - else - failed("BooleanArrayInit() boolean[] x = {"+val+"}"); - } catch (Exception e) { - failed("BooleanArrayInit() "+e); - } - } - public static void ByteArrayInit() - { - try { - byte val = 42; - byte [] x = { 42 }; - if (x[0] == val) - passed("ByteArrayInit() byte[] x = {"+val+"}"); - else - failed("ByteArrayInit() byte[] x = {"+val+"}"); - } catch (Exception e) { - failed("ByteArrayInit() "+e); - } - } - public static void CharArrayInit() - { - try { - char val = 'X'; - char [] x = { 'X' }; - if (x[0] == val) - passed("CharArrayInit() char[] x = {'"+val+"'}"); - else - failed("CharArrayInit() char[] x = {'"+val+"'}"); - } catch (Exception e) { - failed("CharArrayInit() "+e); - } - } - public static void ShortArrayInit() - { - try { - short val = 42; - short [] x = { 42 }; - if (x[0] == val) - passed("ShortArrayInit() short[] x = {"+val+"}"); - else - failed("ShortArrayInit() short[] x = {"+val+"}"); - } catch (Exception e) { - failed("ShortArrayInit() "+e); - } - } - public static void IntArrayInit() - { - try { - int val = 42; - int [] x = { 42 }; - if (x[0] == val) - passed("IntArrayInit() int[] x = {"+val+"}"); - else - failed("IntArrayInit() int[] x = {"+val+"}"); - } catch (Exception e) { - failed("IntArrayInit() "+e); - } - } - public static void failed(String s) - { - if (s != null) - System.out.println("FAILED: " + s); - else - System.out.println("FAILED: "); - } - public static void passed(String s) - { - if (s != null) - System.out.println("PASSED: " + s); - else - System.out.println("PASSED: "); - } - public static void ArrayName(String args[]) - { - try { - String name = args.getClass().getName(); - passed("ArrayName() name="+name); - } catch (Exception e) { - failed("ArrayName() "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/BooleanTest.java b/libjava/classpath/testsuite/java.lang/BooleanTest.java deleted file mode 100644 index caee011..0000000 --- a/libjava/classpath/testsuite/java.lang/BooleanTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Test the Boolean object wrapper class. - * - * @author Brian Jones (brian.jones@oryxsoft.com) - */ -public class BooleanTest -{ - Boolean j; - String x; - - public static void main (String[] argv) - { - BooleanTest test = new BooleanTest(); - - test.constructorsTest(); - test.booleanValueTest(); - test.equalsTest(); - test.getBooleanTest(); - test.hashCodeTest(); - test.toStringTest(); - test.valueOfTest(); - test.variablesTest(); - } - - public void constructorsTest() - { - j = new Boolean(true); // is true - if (j.booleanValue() != true) - failed("Boolean(true)"); - else - passed("Boolean(true)"); - - j = new Boolean(false); // is false - if (j.booleanValue() != false) - failed("Boolean(false)"); - else - passed("Boolean(false)"); - - j = new Boolean("tRuE"); // is true - if (j.booleanValue() != true) - failed("Boolean(\"tRuE\")"); - else - passed("Boolean(String)"); - - j = new Boolean("brian"); // is false - if (j.booleanValue() != false) - failed("Boolean(\"brian\")"); - else - passed("Boolean(String)"); - - j = new Boolean(null); // is false - if (j.booleanValue() != false) - failed("Boolean(null)"); - else - passed("Boolean(String)"); - } - - public void booleanValueTest() - { - if (Boolean.TRUE.booleanValue() != true) - failed("Boolean.booleanValue()"); - else - passed("Boolean.booleanValue()"); - } - - public void equalsTest() - { - j = new Boolean("false"); - if (j.equals(Boolean.FALSE) != true) - failed("Boolean.equals(Object)"); - else - passed("Boolean.equals(Object)"); - } - - public void getBooleanTest() - { - if (Boolean.getBoolean("BIG_DAWG_TEST")) - failed("Boolean.getBoolean(String)"); - else - passed("Boolean.getBoolean(String)"); - } - - public void hashCodeTest() - { - j = new Boolean(null); // is false - boolean caught = false; - try - { - int i = j.hashCode(); - } - catch (Exception e) - { - caught = true; - failed("Boolean.hashCode()"); - } - if (!caught) - passed("Boolean.hashCode()"); - } - - public void toStringTest() - { - j = Boolean.TRUE; - String x = j.toString(); - if (x.equals("true") != true) - failed("j.toString() where j is Boolean.TRUE"); - else - passed("Boolean.toString()"); - - j = Boolean.FALSE; - x = j.toString(); - if (x.equals("false") != true) - failed("j.toString() where j is Boolean.FALSE"); - else - passed("Boolean.toString()"); - } - - public void valueOfTest() - { - j = Boolean.valueOf("tRUe"); // true - if (j.booleanValue() != true) - failed("Boolean.valueOf(String)"); - else - passed("Boolean.valueOf(String)"); - - j = Boolean.valueOf(null); // false - if (j.booleanValue() != false) - failed("Boolean.valueOf(null)"); - else - passed("Boolean.valueOf(null)"); - - j = Boolean.valueOf("lc"); // false - if (j.booleanValue() != false) - failed("Boolean.valueOf(String)"); - else - passed("Boolean.valueOf(String)"); - } - - public void variablesTest() - { - if (Boolean.TRUE.booleanValue() != true) - failed("Boolean.TRUE"); - else - passed("Boolean.TRUE"); - - if (Boolean.FALSE.booleanValue() != false) - failed("Boolean.FALSE"); - else - passed("Boolean.FALSE"); - - x = Boolean.TYPE.getName(); - if (x.equals("boolean") != true) - failed("Boolean.TYPE.getName() is " + x + " != boolean"); - else - passed("Boolean.TYPE.getName() is boolean"); - } - - public void failed(String s) - { - if (s != null) - System.out.println("FAILED: " + s); - else - System.out.println("FAILED: "); - } - - public void passed(String s) - { - if (s != null) - System.out.println("PASSED: " + s); - else - System.out.println("PASSED: "); - } -} - - - - - diff --git a/libjava/classpath/testsuite/java.lang/ByteTest.java b/libjava/classpath/testsuite/java.lang/ByteTest.java deleted file mode 100644 index ef1b193..0000000 --- a/libjava/classpath/testsuite/java.lang/ByteTest.java +++ /dev/null @@ -1,380 +0,0 @@ -import gnu.test.*; - -/** - * Test the Byte object wrapper class. - * - * @author Brian Jones (cbj@gnu.org) - */ -public class ByteTest -{ - public static class constructorTest1 implements Test - { - byte b = 1; - - public String getName() { - return "Byte(byte)"; - } - - public Result test() { - try { - Byte byteObject = new Byte(b); - } catch (Exception e) { - return new Fail(e.getMessage()); - } catch (Error err) { - return new Fail(err.getMessage()); - } - return new Pass(); - } - } - - public static class constructorTest2 implements Test - { - Byte byteObject = null; - - public String getName() { - return "Byte(String)"; - } - - public Result test() { - try { - byteObject = new Byte("1"); - } catch (Exception e) { - return new Fail(e.getMessage()); - } catch (Error err) { - return new Fail(err.getMessage()); - } - return new Pass(); - } - } - - public static class byteValueTest implements Test - { - public String getName() { - return "Byte.byteValue()"; - } - - public Result test() { - byte b = 1; - Byte byteObject = new Byte(b); - if (byteObject.byteValue() == b) - return new Pass(); - else - return new Fail(); - } - } - - public static class decodeTest implements Test - { - public String getName() { - return "Byte.decode(String)"; - } - - public Result test() { - Byte obj = Byte.decode("1"); - if (obj.byteValue() == 1) - return new Pass(); - else - return new Fail(); - } - } - - public static class doubleValueTest implements Test - { - public String getName() { - return "Byte.doubleValue()"; - } - - public Result test() { - byte b = 4; - double d = b; - Byte obj = new Byte(b); - if (obj.doubleValue() == d) - return new Pass(); - else - return new Fail(); - } - } - - public static class equalsTest1 implements Test - { - public String getName() { - return "Byte.equals(Object)"; - } - - public Result test() { - Byte obj1 = null, obj2 = null; - obj1 = new Byte((byte)1); - obj2 = new Byte((byte)2); - if (obj1.equals(obj2)) - return new Fail("1 != 2"); - else - return new Pass("1 != 2"); - } - } - - public static class equalsTest2 implements Test - { - public String getName() { - return "Byte.equals(Object)"; - } - - public Result test() { - Byte obj1 = null, obj2 = null; - obj1 = new Byte((byte)1); - obj2 = new Byte((byte)2); - obj2 = obj1; - if (obj1.equals(obj2)) - return new Pass("1 == 1"); - else - return new Fail("1 == 1"); - } - } - - public static class floatValueTest implements Test - { - public String getName() { - return "Byte.floatValue()"; - } - - public Result test() { - byte b = 4; - float f = b; - Byte obj = new Byte(b); - if (obj.floatValue() == f) - return new Pass(); - else - return new Fail(); - } - } - - public static class hashCodeTest implements Test - { - public String getName() { - return "Byte.hashCode()"; - } - - public Result test() { - boolean caught = false; - Byte obj = new Byte((byte)1); - int i = obj.hashCode(); - if (i == 1) - return new Pass(); - else - return new Fail("hash is " + i + ". It should be 1."); - } - } - - public static class intValueTest implements Test - { - public String getName() { - return "Byte.intValue()"; - } - - public Result test() { - byte b = 4; - int i = b; - Byte obj = new Byte(b); - if (obj.intValue() == i) - return new Pass(); - else - return new Fail(); - } - } - - public static class longValueTest implements Test - { - public String getName() { - return "Byte.longValue()"; - } - - public Result test() { - byte b = 4; - long l = b; - Byte obj = new Byte(b); - if (obj.longValue() == l) - return new Pass(); - else - return new Fail(); - } - } - - public static class parseByteTest1 implements Test - { - public String getName() { - return "Byte.parseByte(String)"; - } - - public Result test() { - byte b = Byte.parseByte("1"); - if (b == (byte)1) - return new Pass(); - else - return new Fail(); - } - } - - public static class parseByteTest2 implements Test - { - public String getName() { - return "Byte.parseByte(String, int)"; - } - - public Result test() { - byte b = Byte.parseByte("-4", 10); - if (b == (byte)-4) - return new Pass(); - else - return new Fail(); - } - } - - public static class shortValueTest implements Test - { - public String getName() { - return "Byte.shortValue()"; - } - - public Result test() { - byte b = 4; - short s = b; - Byte obj = new Byte(b); - if (obj.shortValue() == s) - return new Pass(); - else - return new Fail(); - } - } - - public static class toStringTest1 implements Test - { - public String getName() { - return "Byte.toString()"; - } - - public Result test() { - Byte obj = new Byte((byte)-2); - String x = obj.toString(); - if (x.equals("-2")) - return new Pass(); - else - return new Fail(); - } - } - - public static class toStringTest2 implements Test - { - public String getName() { - return "Byte.toString(byte)"; - } - - public Result test() { - String x = Byte.toString((byte)-2); - if (x.equals("-2")) - return new Pass(); - else - return new Fail(); - } - } - - public static class valueOfTest1 implements Test - { - public String getName() { - return "Byte.valueOf(String, int)"; - } - - public Result test() { - Byte obj1 = Byte.valueOf("2",10); - Byte obj2 = new Byte((byte)2); - if (obj1.intValue() == obj2.intValue()) - return new Pass(); - else - return new Fail(); - } - } - - public static class valueOfTest2 implements Test - { - public String getName() { - return "Byte.valueOf(String)"; - } - - public Result test() { - Byte obj1 = Byte.valueOf("2"); - if (obj1.intValue() == 2) - return new Pass(); - else - return new Fail(); - } - } - - public static class variablesTest1 implements Test - { - public String getName() { - return "Byte.MIN_VALUE"; - } - - public Result test() { - byte min = Byte.MIN_VALUE; - byte max = Byte.MAX_VALUE; - - if (min == (byte)-128) - return new Pass("Byte.MIN_VALUE is -128"); - else - return new Fail("Byte.MIN_VALUE is " + min + " != -128"); - } - } - - public static class variablesTest2 implements Test - { - public String getName() { - return "Byte.MAX_VALUE"; - } - - public Result test() { - byte min = Byte.MIN_VALUE; - byte max = Byte.MAX_VALUE; - - if (max == (byte)127) - return new Pass("Byte.MAX_VALUE is 127"); - else - return new Fail("Byte.MAX_VALUE is " + max + " != 127"); - } - } - - public static class variablesTest3 implements Test - { - public String getName() { - return "Byte.TYPE.getName()"; - } - - public Result test() { - String x = Byte.TYPE.getName(); - if (x.equals("byte") != true) - return new Fail("Byte.TYPE.getName() is " + x + " != byte"); - else - return new Pass("Byte.TYPE.getName() is byte"); - } - } - - public static class typeInstance implements Test - { - public String getName() { - return "Byte.TYPE.newInstance()"; - } - - public Result test() { - try { - Object b = Byte.TYPE.newInstance(); - return new Fail("Byte.TYPE.newInstance succeeded."); - } - catch (InstantiationException e) { - return new Pass("Byte.TYPE.newInstance failed with exception '" + - e.toString() + "'"); - } - catch (Exception ex) { - return new Fail("Byte.TYPE.newInstance threw incorrect exception '" - + ex.toString() + "'"); - } - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/CastTest.java b/libjava/classpath/testsuite/java.lang/CastTest.java deleted file mode 100644 index c33f1c2..0000000 --- a/libjava/classpath/testsuite/java.lang/CastTest.java +++ /dev/null @@ -1,170 +0,0 @@ -public class CastTest -{ - public static void main(String args[]) - { - d2d(); - l2d2l(); - d2l2d(); - f2d2f(); - d2f2d(); - i2f2i(); - l2f2l(); - f2l2f(); - } - - static void d2d() - { - String msg = "double -> double "; - - try { - double dvalue1 = 4.2; - double dvalue2 = (double)dvalue1; - if (dvalue1 != dvalue2) - failed(msg + dvalue1 + " != " + dvalue2); - else - passed(msg + dvalue1 + " == " + dvalue2); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - - static void l2f2l() - { - String msg = "long -> float -> long "; - - try { - long lvalue = 123; - float fvalue = (float)lvalue; - long lvalue2 = (long)fvalue; - if (lvalue != lvalue2) - failed(msg + lvalue + " != " + lvalue2 + " (float)" + fvalue); - else - passed(msg + lvalue + " == " + lvalue2 + " (float)" + fvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void i2f2i() - { - String msg = "int -> float -> int "; - - try { - int ivalue = 123; - float fvalue = (float)ivalue; - int ivalue2 = (int)fvalue; - if (ivalue != ivalue2) - failed(msg + ivalue + " != " + ivalue2 + " (float)" + fvalue); - else - passed(msg + ivalue + " == " + ivalue2 + " (float)" + fvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void f2d2f() - { - String msg = "float -> double -> float "; - - try { - float fvalue = 123.0f; - double dvalue = (double)fvalue; - float fvalue2 = (float)dvalue; - - if (fvalue != fvalue2) - failed(msg + fvalue + " != " + fvalue2 + " (double)" + dvalue); - else - passed(msg + fvalue + " == " + fvalue2 + " (double)" + dvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void f2l2f() - { - String msg = "float -> long -> float "; - - try { - float fvalue = 123.0f; - long lvalue = (long)fvalue; - float fvalue2 = (float)lvalue; - - if (fvalue != fvalue2) - failed(msg + fvalue + " != " + fvalue2 + " (long)" + lvalue); - else - passed(msg + fvalue + " == " + fvalue2 + " (long)" + lvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void d2f2d() - { - String msg = "double -> float -> double "; - - try { - double dvalue = 123.0; - float fvalue = (float)dvalue; - double dvalue2 = (double)fvalue; - if (dvalue != dvalue2) - failed(msg + dvalue + " != " + dvalue2 + " (float)" + fvalue); - else - passed(msg + dvalue + " == " + dvalue2 + " (float)" + fvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void l2d2l() - { - String msg = "long -> double -> long "; - - try { - long lvalue = 1023; - double dvalue = (double)lvalue; - long lvalue2 = (long)dvalue; - - if (lvalue != lvalue2) - failed(msg + lvalue + " != " + lvalue2 + " (double)" + dvalue); - else - passed(msg + lvalue + " == " + lvalue2 + " (double)" + dvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void d2l2d() - { - String msg = "double -> long -> double "; - - try { - double dvalue = 123.0; - long lvalue = (long)dvalue; - double dvalue2 = (double)lvalue; - if (dvalue != dvalue2) - failed(msg + dvalue + " != " + dvalue2 + " (long)" + lvalue); - else - passed(msg + dvalue + " == " + dvalue2 + " (long)" + lvalue); - } - catch (Exception e) - { - failed(msg + " : exception " + e.toString()); - } - } - static void passed(String msg) - { - System.out.println("PASSED: "+msg); - } - static void failed(String msg) - { - System.out.println("FAILED: "+msg); - } -} diff --git a/libjava/classpath/testsuite/java.lang/ClassForNameTest.java b/libjava/classpath/testsuite/java.lang/ClassForNameTest.java deleted file mode 100644 index c69df93..0000000 --- a/libjava/classpath/testsuite/java.lang/ClassForNameTest.java +++ /dev/null @@ -1,25 +0,0 @@ -public class ClassForNameTest -{ - public static void main(String args[]) { - Class c; - /* test for both success and failure */ - - try { - c = Class.forName("ClassForNameTest"); - } - catch (Exception e) { - System.out.println("FAILED: Couldn't find ClassForNameTest."); - System.exit(0); - } - - try { - c = Class.forName("ClazzForNameT3st"); - } - catch (Exception e) { - System.out.println("PASSED: passed both success and failure cases for Class.forName"); - System.exit(0); - } - - System.out.println("FAILED: Didn't raise exception for incorrect class name."); - } -} diff --git a/libjava/classpath/testsuite/java.lang/ExceptionTest.java b/libjava/classpath/testsuite/java.lang/ExceptionTest.java deleted file mode 100644 index 7a464db..0000000 --- a/libjava/classpath/testsuite/java.lang/ExceptionTest.java +++ /dev/null @@ -1,21 +0,0 @@ -public class ExceptionTest -{ - static int foo() throws ArrayIndexOutOfBoundsException { - int f[] = new int[10]; - - return f[26]; - } - - public static void main (String args[]) { - int f; - - try { - f = foo(); - } - catch (ArrayIndexOutOfBoundsException e) { - System.out.println("PASSED: " + e.toString()); - } catch (Exception e) { - System.out.println("FAILED: " + e.toString()); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/FloatingDecimalTest.java b/libjava/classpath/testsuite/java.lang/FloatingDecimalTest.java deleted file mode 100644 index f49ef7b..0000000 --- a/libjava/classpath/testsuite/java.lang/FloatingDecimalTest.java +++ /dev/null @@ -1,19 +0,0 @@ -public class FloatingDecimalTest -{ - public static void main(String args[]) { -/* - try { -*/ - double d = 1.0; - String result; - result = "Double is " +d + " and kicking"; - System.out.println("PASSED: "+result); -/* - } - catch (Exception e) - { - System.out.println("FAILED: exception " + e.toString()); - } -*/ - } -} diff --git a/libjava/classpath/testsuite/java.lang/IsInstanceTest.java b/libjava/classpath/testsuite/java.lang/IsInstanceTest.java deleted file mode 100644 index f5a828a..0000000 --- a/libjava/classpath/testsuite/java.lang/IsInstanceTest.java +++ /dev/null @@ -1,32 +0,0 @@ -class IsInstanceTest extends Thread implements Cloneable -{ - static void main(String args[]) - { - IsInstanceTest test = new IsInstanceTest(); - - if (test instanceof java.lang.Object) - pass("IsInstanceTest is instance of java.lang.Object"); - else - fail("IsInstanceTest is not instance of java.lang.Object"); - - if (test instanceof java.lang.Cloneable) - pass("IsInstanceTest is instance of java.lang.Cloneable"); - else - fail("IsInstanceTest is not instance of java.lang.Cloneable"); - - if (test instanceof java.lang.Runnable) - pass("IsInstanceTest is instance of java.lang.Runnable"); - else - fail("IsInstanceTest is not instance of java.lang.Runnable"); - - - } - static void pass(String message) - { - System.out.println("PASSED: "+message); - } - static void fail(String message) - { - System.out.println("FAILED: "+message); - } -} diff --git a/libjava/classpath/testsuite/java.lang/JoinTest.java b/libjava/classpath/testsuite/java.lang/JoinTest.java deleted file mode 100644 index 5d5d62d..0000000 --- a/libjava/classpath/testsuite/java.lang/JoinTest.java +++ /dev/null @@ -1,77 +0,0 @@ -public class JoinTest - implements Runnable -{ - public static int count = 0; - - void send() - throws Exception - { - Thread.sleep(2000); - System.out.println("PASSED: Sender completed"); - } - void receive() - throws Exception - { - synchronized(this) { - notifyAll(); - } - - Thread.sleep(5000); - count++; - System.out.println("PASSED: Receiver completed"); - } - - public void run() - { - String name = Thread.currentThread().getName(); - if (name.equals("timer")) { - try { - Thread.sleep(10000); - } catch (InterruptedException e){} - System.out.println("FAILED: timer triggered"); - System.exit(1); - } - try { - receive(); - } catch (Exception e) { - System.out.println("FAILED: receiver: " + e); - System.exit(1); - } - } - public static void main(String args[]) - { - try { - JoinTest sender = - new JoinTest(); - JoinTest receiver = - new JoinTest(); - Thread receiver_thread = new Thread(receiver); - - /* Make sure the test terminates even if it hangs on network */ - JoinTest timer = new JoinTest(); - Thread timer_thread = new Thread(timer, "timer"); - timer_thread.start(); - - synchronized(receiver) { - receiver_thread.start(); - receiver.wait(); - } - try { - sender.send(); - } catch (Exception e) { - System.out.println("FAILED: sender: " + e); - System.exit(1); - } - receiver_thread.join(); - - if (0 == count) - throw new Exception("Nothing received"); - - System.out.println("PASSED: Join send/receive count="+count); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: " + e); - System.exit(1); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/LongFieldTest.java b/libjava/classpath/testsuite/java.lang/LongFieldTest.java deleted file mode 100644 index dc5be61..0000000 --- a/libjava/classpath/testsuite/java.lang/LongFieldTest.java +++ /dev/null @@ -1,12 +0,0 @@ -public class LongFieldTest -{ - static long field; - - public static void main(String args[]) - { - field = 1L; - - if (field == 1) - System.out.println("PASSED: field = " + field); - } -} diff --git a/libjava/classpath/testsuite/java.lang/NewInstanceTest.java b/libjava/classpath/testsuite/java.lang/NewInstanceTest.java deleted file mode 100644 index 845bb42..0000000 --- a/libjava/classpath/testsuite/java.lang/NewInstanceTest.java +++ /dev/null @@ -1,24 +0,0 @@ -public class NewInstanceTest -{ - public NewInstanceTest() { - static_field = 1; - } - - public static void main(String args[]) { - try { - Class cls = Class.forName("NewInstanceTest"); - Object instance = cls.newInstance(); - - if (static_field == 1) - System.out.println("PASSED: static_field = " + static_field); - else - System.out.println("FAILED: static_field = " + static_field); - } - catch (Exception e) - { - System.out.println("FAILED: exception " + e.toString()); - } - } - - public static int static_field; -} diff --git a/libjava/classpath/testsuite/java.lang/NullcastTest.java b/libjava/classpath/testsuite/java.lang/NullcastTest.java deleted file mode 100644 index 75588d6..0000000 --- a/libjava/classpath/testsuite/java.lang/NullcastTest.java +++ /dev/null @@ -1,20 +0,0 @@ -import java.lang.*; - -public class NullcastTest -{ - static String retString(String str1, String str2) - { - return str1; - } - public static void main (String args[]) { - try { - - String tmp = retString((String) null, (String)null); - - System.out.println("PASSED: (String)null"); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/OutOfMemoryErrorTest.java b/libjava/classpath/testsuite/java.lang/OutOfMemoryErrorTest.java deleted file mode 100644 index 2dd6b15..0000000 --- a/libjava/classpath/testsuite/java.lang/OutOfMemoryErrorTest.java +++ /dev/null @@ -1,64 +0,0 @@ -import java.util.Vector; - -/** - * Under JavaSoft's VM they arbitarily limit the amount of memory - * a Java application can use (though this can be overridden). The - * point here is to check to see whether or not an application being - * run by Japhar will ever get the OutOfMemoryError or not when resources - * are scarce. --brian - */ -public class OutOfMemoryErrorTest -{ - public static void main(String[] argv) - { - Vector v = null; - Runtime r = null; - long free = 0, total = 0; - // quickly approach memory limit 1M at a time - try { - r = Runtime.getRuntime(); - v = new Vector(); - while(true) - { - v.addElement(new byte[1048576]); - } - } - // out of memory error - catch (OutOfMemoryError oomerr1) - { - // slowly encroach on memory limit 2 bytes+ at a time - try { - while(true) - { - v.addElement(new byte[2]); - } - } - // out of memory error - catch (OutOfMemoryError oomerr2) - { - if (r != null) - { - free = r.freeMemory(); - total = r.totalMemory(); - v = null; - r.gc(); -// System.out.println("free = " + free); -// System.out.println("total = " + total); - System.out.println("PASSED: "); - } - else - System.out.println("FAILED: runtime unknown"); - } - } - // generic error - catch (Error err) - { - System.out.println("FAILED: unexpected error"); - } - // generic exception - catch (Exception e) - { - System.out.println("FAILED: unexpected exception"); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/StringTest.java b/libjava/classpath/testsuite/java.lang/StringTest.java deleted file mode 100644 index cd9d83d..0000000 --- a/libjava/classpath/testsuite/java.lang/StringTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Aaron M. Renn reported a bug in Japhar having string length 17 for - * this string - */ - -public class StringTest -{ - public static void - main(String[] argv) - { - UnicodeStringLength(); - } - static void UnicodeStringLength() - { - String str = "a-->\u01FF\uA000\u6666\u0200RRR"; - int len = str.length(); - if (11 == len) { - System.out.println("PASSED: " + str + " has len=" +str.length()); - } else { - System.out.println("FAILED: " + str + - " has len=" +str.length() + " != 11"); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/SyncronizedTest.java b/libjava/classpath/testsuite/java.lang/SyncronizedTest.java deleted file mode 100644 index 61115ef..0000000 --- a/libjava/classpath/testsuite/java.lang/SyncronizedTest.java +++ /dev/null @@ -1,59 +0,0 @@ -public class SyncronizedTest - implements Runnable -{ - public static int count = 0; - String _name; - - public SyncronizedTest(String name) - { - _name = name; - } - - public void run() - { - if (_name.equals("timer")) { - try { - Thread.sleep(10000); - } catch (InterruptedException e){} - System.out.println("FAILED: timer triggered"); - System.exit(1); - } - try { - count++; - - synchronized(this) { - notifyAll(); - } - } catch (Exception e) { - System.out.println("FAILED: receiver: " + e); - System.exit(1); - } - } - public static void main(String args[]) - { - try { - SyncronizedTest tester = new SyncronizedTest("tester"); - Thread tester_thread = new Thread(tester); - - SyncronizedTest timer = new SyncronizedTest("timer"); - Thread timer_thread = new Thread(timer); - timer_thread.start(); - - synchronized(tester) { - tester_thread.start(); - tester.wait(); - } - - if (0 == count) - throw new Exception("Thread did not run."); - - tester_thread.join(); - - System.out.println("PASSED: count="+count); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: " + e); - System.exit(1); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/TestCasts.java b/libjava/classpath/testsuite/java.lang/TestCasts.java deleted file mode 100644 index 4ee0abf..0000000 --- a/libjava/classpath/testsuite/java.lang/TestCasts.java +++ /dev/null @@ -1,477 +0,0 @@ -/* Written by Artur Biesiadowski <abies@pg.gda.pl> */ - -/* - This class test basic 4 conversion types and compares results to ready ones, done - on sure VM (suns JDK). Conversions are - (obj instanceof clazz) - (clazz)obj - clazz.isInstance(obj) - clazz1.isAssignableFrom(clazz2); - - Hopefully all needed cases are covered. If you want to add object just put it - into objs table. If you want to add class, you need to add it to both cls and to - testCode method. Of course you need to regenerate results after that. - */ - - -/* - You can copy/modify/use this file for any purposes, as long as you do not delete - my name from top of that file. Of course you can add your own below that :) - */ - - -import java.io.*; - -interface I1 {} -interface I2 {} -interface I3 extends I2{} -class A1 implements I1 {} -class AB12 extends A1 implements I2 {} -class ABC12 extends AB12 {} -class D3 implements I3 {} - -public class TestCasts -{ - - public Object objs[] = - { - null, - new Object(), - new A1(), - new AB12(), - new ABC12(), - new D3(), - new A1[1], - new AB12[1], - new ABC12[1], - new D3[1], - new I1[1], - new I2[1], - new I3[1], - new int[1], - new A1[1][1], - new AB12[1][1], - new I1[1][1] - }; - - public Class cls[] = - { - Object.class, - A1.class, - AB12.class, - ABC12.class, - D3.class, - I1.class, - I2.class, - I3.class, - Cloneable.class, - Serializable.class, - A1[].class, - AB12[].class, - ABC12[].class, - D3[].class, - I1[].class, - I2[].class, - I3[].class, - int[].class, - A1[][].class, - AB12[][].class, - I1[][].class - }; - - java.util.Vector results = new java.util.Vector(1000); - boolean verbose = false; - boolean generate = false; - String filename = "TestCasts-results.txt"; - - public static void main(String argv[] ) - { - TestCasts tc = new TestCasts(); - if ( argv.length > 0 ) - { - int i; - for ( i =0; i < argv.length;i++ ) - { - if ( argv[i].equals("-g") ) - { - tc.generate = true; - } - else if ( argv[i].equals("-v") ) - { - tc.verbose = true; - } - else if ( argv[i].equals("-f") ) - { - i++; - if ( i > argv.length ) - { - System.out.println("You need to specify filename after -f"); - System.exit(1); - } - tc.filename = argv[i]; - } - else - { - System.out.println( "Options are: -v -g -f file"); - System.out.println( "[-v] verbose "); - System.out.println( "[-g] generate result table"); - System.out.println( "[-f file] read/write tests from/to file (default "+tc.filename+")"); - System.exit(1); - } - } - } - - - tc.test(); - //System.out.println(tc.results); - System.out.println( "Performed " + tc.counter + " tests"); - if ( tc.generate ) - System.out.println( "True: " + tc.genTrue + "\tfalse: " + tc.genFalse); - else - { - System.out.println( "Passed: " + tc.passed + "\tfailed: " + tc.failed); - if (tc.failed == 0 ) - System.out.println("PASSED: all cast tests"); - } - } - - - public final void test() - { - if (!generate) - readResultsFromFile(); - - int i; - int j; - for ( i=0; i < objs.length; i++ ) - { - for ( j=0; j < cls.length; j++ ) - { - reportClIsInst(objs[i], cls[j], cls[j].isInstance(objs[i]) ); - } - } - - for (i=0; i < objs.length; i++ ) - { - testCode(objs[i]); - } - - for ( i=0; i < cls.length; i++ ) - { - for ( j=0; j < cls.length; j++ ) - { - reportClIsAssign(cls[i], cls[j], cls[i].isAssignableFrom(cls[j])); - } - } - - if ( generate ) - writeResultsToFile(); - } - - - public final void testCode(Object o) - { - - reportInstanceof(o, Object.class, (o instanceof Object) ); - try - { - Object r1 = (Object) o; - reportCast(o, Object.class, true ); - } catch (ClassCastException e) { - reportCast(o,Object.class, false ); - } - - reportInstanceof(o, A1.class, (o instanceof A1) ); - try - { - A1 r1 = (A1) o; - reportCast(o, A1.class, true ); - } catch (ClassCastException e) { - reportCast(o,A1.class, false ); - } - reportInstanceof(o, AB12.class, (o instanceof AB12) ); - try - { - AB12 r1 = (AB12) o; - reportCast(o, AB12.class, true ); - } catch (ClassCastException e) { - reportCast(o,AB12.class, false ); - } - reportInstanceof(o, ABC12.class, (o instanceof ABC12) ); - try - { - ABC12 r1 = (ABC12) o; - reportCast(o, ABC12.class, true ); - } catch (ClassCastException e) { - reportCast(o,ABC12.class, false ); - } - reportInstanceof(o, D3.class, (o instanceof D3) ); - try - { - D3 r1 = (D3) o; - reportCast(o, D3.class, true ); - } catch (ClassCastException e) { - reportCast(o,D3.class, false ); - } - reportInstanceof(o, I1.class, (o instanceof I1) ); - try - { - I1 r1 = (I1) o; - reportCast(o, I1.class, true ); - } catch (ClassCastException e) { - reportCast(o,I1.class, false ); - } - reportInstanceof(o, I2.class, (o instanceof I2) ); - try - { - I2 r1 = (I2) o; - reportCast(o, I2.class, true ); - } catch (ClassCastException e) { - reportCast(o,I2.class, false ); - } - reportInstanceof(o, I3.class, (o instanceof I3) ); - try - { - I3 r1 = (I3) o; - reportCast(o, I3.class, true ); - } catch (ClassCastException e) { - reportCast(o,I3.class, false ); - } - reportInstanceof(o, Cloneable.class, (o instanceof Cloneable) ); - try - { - Cloneable r1 = (Cloneable) o; - reportCast(o, Cloneable.class, true ); - } catch (ClassCastException e) { - reportCast(o,Cloneable.class, false ); - } - - reportInstanceof(o, Serializable.class, (o instanceof Serializable) ); - try - { - Serializable r1 = (Serializable) o; - reportCast(o, Serializable.class, true ); - } catch (ClassCastException e) { - reportCast(o,Serializable.class, false ); - } - reportInstanceof(o, A1[].class, (o instanceof A1[]) ); - try - { - A1[] r1 = (A1[]) o; - reportCast(o, A1[].class, true ); - } catch (ClassCastException e) { - reportCast(o,A1[].class, false ); - } - - reportInstanceof(o, AB12[].class, (o instanceof AB12[]) ); - try - { - AB12[] r1 = (AB12[]) o; - reportCast(o, AB12[].class, true ); - } catch (ClassCastException e) { - reportCast(o,AB12[].class, false ); - } - reportInstanceof(o, ABC12[].class, (o instanceof ABC12[]) ); - try - { - ABC12[] r1 = (ABC12[]) o; - reportCast(o, ABC12[].class, true ); - } catch (ClassCastException e) { - reportCast(o,ABC12[].class, false ); - } - reportInstanceof(o, D3[].class, (o instanceof D3[]) ); - try - { - D3[] r1 = (D3[]) o; - reportCast(o, D3[].class, true ); - } catch (ClassCastException e) { - reportCast(o,D3[].class, false ); - } - reportInstanceof(o, I1[].class, (o instanceof I1[]) ); - try - { - I1[] r1 = (I1[]) o; - reportCast(o, I1[].class, true ); - } catch (ClassCastException e) { - reportCast(o,I1[].class, false ); - } - reportInstanceof(o, I2[].class, (o instanceof I2[]) ); - try - { - I2[] r1 = (I2[]) o; - reportCast(o, I2[].class, true ); - } catch (ClassCastException e) { - reportCast(o,I2[].class, false ); - } - - reportInstanceof(o, I3[].class, (o instanceof I3[]) ); - try - { - I3[] r1 = (I3[]) o; - reportCast(o, I3[].class, true ); - } catch (ClassCastException e) { - reportCast(o,I3[].class, false ); - } - - reportInstanceof(o, int[].class, (o instanceof int[]) ); - try - { - int[] r1 = (int[]) o; - reportCast(o, int[].class, true ); - } catch (ClassCastException e) { - reportCast(o,int[].class, false ); - } - - reportInstanceof(o, A1[][].class, (o instanceof A1[][]) ); - try - { - A1[][] r1 = (A1[][]) o; - reportCast(o, A1[][].class, true ); - } catch (ClassCastException e) { - reportCast(o,A1[][].class, false ); - } - reportInstanceof(o, AB12[][].class, (o instanceof AB12[][]) ); - try - { - AB12[][] r1 = (AB12[][]) o; - reportCast(o, AB12[][].class, true ); - } catch (ClassCastException e) { - reportCast(o,AB12[][].class, false ); - } - reportInstanceof(o, I1[][].class, (o instanceof I1[][]) ); - try - { - I1[][] r1 = (I1[][]) o; - reportCast(o, I1[][].class, true ); - } catch (ClassCastException e) { - reportCast(o,I1[][].class, false ); - } - - } - - int counter = 0; - int passed = 0; - int failed = 0; - int genTrue = 0; - int genFalse =0; - - public final boolean result(boolean b ) - { - counter++; - if ( generate ) - { - if (b ) - { - genTrue++; - results.addElement(Boolean.TRUE); - } - else - { - genFalse++; - results.addElement(Boolean.FALSE); - } - return true; - } - else - { - if ( ((Boolean)results.elementAt(counter-1)).booleanValue() != b ) - { - failed++; - return false; - } - else - { - passed++; - return true; - } - } - - } - - public final void reportClIsInst(Object obj, Class cl, boolean b ) - { - if ( result(b) ) - { - if ( verbose ) - System.out.println("PASSED: "+obj +"\tis\t"+ cl + "\t?" + b); - } - else - { - System.out.println("FAILED: " + cl + ".isInstance(" + obj + ") is\t" + b ); - } - } - - public final void reportClIsAssign( Class c1, Class c2, boolean b ) - { - if ( result(b) ) - { - if (verbose) - System.out.println("PASSED: "+c1 + "\tisAssignableFrom\t" + c2 + "\t?\t" + b); - } - else - { - System.out.println("FAILED: " + c1 + ".isAssigableFrom(" + c2 + ") is " + b); - } - } - - public final void reportInstanceof( Object obj, Class cl, boolean b ) - { - if ( result(b) ) - { - if ( verbose ) - System.out.println("PASSED: "+obj +"\tinstanceof\t"+ cl + "\t?" + b); - } - else - { - System.out.println("FAILED: (" + obj + "instanceof\t" + cl + ")\tis\t" + b ); - } - } - - public final void reportCast( Object obj, Class cl, boolean b ) - { - if ( result(b) ) - { - if ( verbose ) - System.out.println("PASSED: "+obj +"\tcastto \t"+ cl + "\t?" + b); - } - else - { - System.out.println("FAILED: " + obj + "\tcastto \t" + cl + "\tis\t" + b ); - } - } - - public final void readResultsFromFile() - { - try{ - int i; - FileInputStream fin = new FileInputStream(filename); - while ( (i=fin.read()) != -1 ) - { - results.addElement( i==1 ? Boolean.TRUE : Boolean.FALSE ); - } - } catch (IOException e ) - { - System.out.println("Cannot read from file " + filename); - System.out.println(e); - System.exit(1); - } - } - - public final void writeResultsToFile() - { - try{ - int i; - FileOutputStream fos = new FileOutputStream(filename); - for ( i=0; i < counter; i++ ) - { - fos.write( ((Boolean)results.elementAt(i)).booleanValue() ? 1 : 0 ); - } - fos.close(); - } catch (IOException e ) - { - System.out.println("Cannot read from file " + filename); - System.out.println(e); - System.exit(1); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/ThreadTest.java b/libjava/classpath/testsuite/java.lang/ThreadTest.java deleted file mode 100644 index cade822..0000000 --- a/libjava/classpath/testsuite/java.lang/ThreadTest.java +++ /dev/null @@ -1,48 +0,0 @@ -import java.lang.*; - -/* Simple producer/consumer thread test. */ - -public class ThreadTest implements Runnable { - - static String threadName = "Running thread"; - static int count = 0; - static int max = 4; // XXX Seem to fail when >4 on kaffe 0.9.0 - - public void run() { - if (! Thread.currentThread().isAlive() ) { - System.out.println("FAILED: isAlive() false in new thread!"); - } else { - System.out.println("PASSED: isAlive() working in new thread"); - } - while (0 <= count && count <= max) { - count ++; - } - } - - public static void main (String args[]) { - try { - if (! Thread.currentThread().isAlive() ) { - System.out.println("FAILED: isAlive() false in initial thread!"); - } else { - System.out.println("PASSED: isAlive() working in initial thread"); - } - ThreadTest test = new ThreadTest(); - - Thread testThread = new Thread(test, threadName); - - testThread.setDaemon(true); - testThread.start(); - - Thread.currentThread().sleep(3000); - - if (count < max) { - System.out.println("FAILED: unable to run new thread"); - } else { - System.out.println("PASSED: Theads worked"); - } - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.lang/execute.exp b/libjava/classpath/testsuite/java.lang/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.lang/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java b/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java deleted file mode 100644 index b1614d2..0000000 --- a/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java +++ /dev/null @@ -1,114 +0,0 @@ -import java.net.*; - -/* - * Start one thread for receiving a packet, wait for it to set up, - * send a packet to it, and wait until it completes. Compare the - * packet to make sure it came thru without errors. - */ - -public class DatagramSocketSendReceiveTest - implements Runnable -{ - public static final int port = 4000 + (int)(java.lang.Math.random() * 1000); - public static final String message = "hello"; - public static int count = 0; - public static String received; - - void send() - throws Exception - { - DatagramSocket sender = new DatagramSocket(); - InetAddress local = sender.getLocalAddress(); - byte []message_bytes = message.getBytes(); - - DatagramPacket packet = new DatagramPacket(message_bytes, - message_bytes.length, - local, port); - - sender.send(packet); - sender.close(); - } - void receive() - throws Exception - { - DatagramSocket socket = new DatagramSocket(port); - socket.setSoTimeout(10); - - byte[] buffer = new byte[100]; - DatagramPacket packet = new DatagramPacket(buffer, buffer.length); - - synchronized(this) { - notifyAll(); - } - - socket.receive(packet); - socket.close(); - - received = new String(buffer, 0, packet.getLength()); - - count++; - if ( message.length() != received.length() ) - throw new Exception("Receved "+ received.length()+ - " bytes but sent "+message.length() + " bytes"); - - if ( ! message.equals(received) ) - throw new Exception("Receved \""+ received+ - "\" but sent \""+message + "\""); - - } - - public void run() - { - String name = Thread.currentThread().getName(); - if (name.equals("timer")) { - try { - Thread.sleep(10000); - } catch (InterruptedException e){} - System.out.println("FAILED: timer triggered"); - System.exit(0); - } - try { - receive(); - } catch (Exception e) { - System.out.println("FAILED: receiver: " + e); - System.exit(0); - } - } - public static void main(String args[]) - { - try { - DatagramSocketSendReceiveTest sender = - new DatagramSocketSendReceiveTest(); - DatagramSocketSendReceiveTest receiver = - new DatagramSocketSendReceiveTest(); - Thread receiver_thread = new Thread(receiver); - - /* Make sure the test terminates even if it hangs on network */ - DatagramSocketSendReceiveTest timer = new DatagramSocketSendReceiveTest(); - Thread timer_thread = new Thread(timer, "timer"); - timer_thread.start(); - - synchronized(receiver) { - receiver_thread.start(); - receiver.wait(); - } - try { - sender.send(); - } catch (Exception e) { - System.out.println("FAILED: sender: " + e); - System.exit(0); - } - receiver_thread.join(); - - if (0 == count) - throw new Exception("Nothing received"); - - System.out.println("PASSED: DatagramSocket send/receive count="+count+ - " message="+received); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: " + e); - System.exit(0); - } - } -} diff --git a/libjava/classpath/testsuite/java.net/DatagramSocketTest.java b/libjava/classpath/testsuite/java.net/DatagramSocketTest.java deleted file mode 100644 index 4ee0d49..0000000 --- a/libjava/classpath/testsuite/java.net/DatagramSocketTest.java +++ /dev/null @@ -1,23 +0,0 @@ -import java.net.*; - -public class DatagramSocketTest -{ - public static void main(String args[]) - { - try { - DatagramSocket socket = new DatagramSocket(); - - InetAddress local = socket.getLocalAddress(); - - int port = socket.getLocalPort(); - - socket.setSoTimeout(socket.getSoTimeout()); - - socket.close(); - - System.out.println("PASSED: new DatagramSocket()"); - } catch (Exception e) { - System.out.println("FAILED: " + e); - } - } -} diff --git a/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java b/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java deleted file mode 100644 index 15ab983..0000000 --- a/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java +++ /dev/null @@ -1,113 +0,0 @@ -import java.net.*; -import java.io.*; - -/* - * Start one thread for receiving a packet, wait for it to set up, - * send a packet to it, and wait until it completes. Compare the - * packet to make sure it came thru without errors. - */ - -public class SocketSendReceiveTest - implements Runnable -{ - public static final int port = 4000 + (int)(java.lang.Math.random() * 2000); - public static final String message = "hello"; - public static int count = 0; - public static String received; - - void send() - throws Exception - { - InetAddress local = InetAddress.getLocalHost(); - Socket sender = new Socket(local, port); - byte []message_bytes = message.getBytes(); - - DataOutputStream out = new DataOutputStream(sender.getOutputStream()); - out.write(message_bytes, 0, message_bytes.length); - out.flush(); - sender.close(); - } - void receive() - throws Exception - { - ServerSocket socket = new ServerSocket(port); - - synchronized(this) { - notifyAll(); - } - - Socket connection = socket.accept(); - DataInputStream in = new DataInputStream(connection.getInputStream()); - - byte[] buffer = new byte[100]; - - int length = in.read(buffer); - - connection.close(); - socket.close(); - - received = new String(buffer, 0, length); - - count++; - if ( message.length() != received.length() ) - throw new Exception("Receved "+ received.length()+ - " bytes but sent "+message.length() + " bytes"); - - if ( ! message.equals(received) ) - throw new Exception("Receved \""+ received+ - "\" but sent \""+message + "\""); - } - - public void run() - { - String name = Thread.currentThread().getName(); - if (name.equals("timer")) { - try { - Thread.sleep(10000); - } catch (InterruptedException e){} - System.out.println("FAILED: timer triggered"); - System.exit(0); - } - try { - receive(); - } catch (Exception e) { - System.out.println("FAILED: receiver (port "+port + "): " + e); - System.exit(0); - } - } - public static void main(String args[]) - { - try { - SocketSendReceiveTest sender = new SocketSendReceiveTest(); - SocketSendReceiveTest receiver = new SocketSendReceiveTest(); - Thread receiver_thread = new Thread(receiver); - - /* Make sure the test terminates even if it hangs on network */ - SocketSendReceiveTest timer = new SocketSendReceiveTest(); - Thread timer_thread = new Thread(timer, "timer"); - timer_thread.start(); - - synchronized(receiver) { - receiver_thread.start(); - receiver.wait(); - } - try { - sender.send(); - } catch (Exception e) { - System.out.println("FAILED: receiver (port "+port + "): " + e); - System.exit(0); - } - receiver_thread.join(); - - if (0 == count) - throw new Exception("Nothing received"); - - System.out.println("PASSED: Socket send/receive count="+count+ - " message="+received); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: " + e); - System.exit(0); - } - } -} diff --git a/libjava/classpath/testsuite/java.net/SocketTest.java b/libjava/classpath/testsuite/java.net/SocketTest.java deleted file mode 100644 index 78a367b..0000000 --- a/libjava/classpath/testsuite/java.net/SocketTest.java +++ /dev/null @@ -1,34 +0,0 @@ -import java.net.*; - -public class SocketTest -{ - public static void main(String args[]) - { - try { - Socket socket = new Socket("www.hungry.com", 80); - - InetAddress remote = socket.getInetAddress(); - InetAddress local = socket.getLocalAddress(); - - int rport = socket.getPort(); - int lport = socket.getLocalPort(); - - socket.setSoTimeout(socket.getSoTimeout()); - socket.setTcpNoDelay(socket.getTcpNoDelay()); - int linger = socket.getSoLinger(); - if (-1 != linger) - socket.setSoLinger(true, linger); - else - socket.setSoLinger(false, 0); - - String socketString = socket.toString(); - if (null == socketString) - throw new Exception("toString() failed"); - - socket.close(); - System.out.println("PASSED: new Socket()" + socketString); - } catch (Exception e) { - System.out.println("FAILED: " + e); - } - } -} diff --git a/libjava/classpath/testsuite/java.net/URLTest.java b/libjava/classpath/testsuite/java.net/URLTest.java deleted file mode 100644 index 026ea12..0000000 --- a/libjava/classpath/testsuite/java.net/URLTest.java +++ /dev/null @@ -1,23 +0,0 @@ -import java.net.*; -import java.io.*; - -public class URLTest -{ - public static void main(String args[]) - { - try { - URL url = new URL("http://www.hungry.com/"); - InputStream stream = url.openStream(); - - int size = 0; - - while (-1 != stream.read()) { size++; } - - stream.close(); - - System.out.println("PASSED: new URL() size=" + size ); - } catch (Exception e) { - System.out.println("FAILED: " + e); - } - } -} diff --git a/libjava/classpath/testsuite/java.net/execute.exp b/libjava/classpath/testsuite/java.net/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.net/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.opstack/LeftBehind.j b/libjava/classpath/testsuite/java.opstack/LeftBehind.j deleted file mode 100644 index 30a82c4..0000000 --- a/libjava/classpath/testsuite/java.opstack/LeftBehind.j +++ /dev/null @@ -1,64 +0,0 @@ -; -; LeftBehind.j - contrived test to see how japhar reacts to -; stuff left on the stack after a method returns. -.class public LeftBehind -.super java/lang/Object - -.method public static test()I - .limit stack 10 ; up to 10 items can be pushed - - ; push some ints. - bipush 1 - bipush 2 - bipush 3 - bipush 4 - bipush 5 - ; then push some strings. - ldc "6th item" - ldc "7th item" - - bipush 5 - - ; now push our return value - bipush 9 - - ireturn -.end method - -.method public static main([Ljava/lang/String;)V - .limit stack 3 ; up to three items can be pushed - - ; we push a value onto the stack, and - ; then check to see that only one item (the return - ; value from the test() method) is on the stack on top - ; of it. - bipush 8 - - invokestatic LeftBehind/test()I - - pop ; get rid of the return value - bipush 8 - isub - - ifeq pass - -fail: - ; push System.out onto the stack - getstatic java/lang/System/out Ljava/io/PrintStream; - - ldc "FAILED:" - - invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V - bipush 0 - invokestatic java/lang/System/exit(I)V - -pass: - ; push System.out onto the stack - getstatic java/lang/System/out Ljava/io/PrintStream; - - ldc "PASSED:" - - invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V - bipush 0 - invokestatic java/lang/System/exit(I)V -.end method diff --git a/libjava/classpath/testsuite/java.opstack/execute.exp b/libjava/classpath/testsuite/java.opstack/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.opstack/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.sun.awt/FrameMenuTest.java b/libjava/classpath/testsuite/java.sun.awt/FrameMenuTest.java deleted file mode 100644 index 1ccc3db..0000000 --- a/libjava/classpath/testsuite/java.sun.awt/FrameMenuTest.java +++ /dev/null @@ -1,40 +0,0 @@ -import java.awt.*; -import java.awt.event.*; - -public class FrameMenuTest - extends Frame -{ - public static void main(String args[]) - { - FrameMenuTest frame = new FrameMenuTest(); - frame.pack(); - frame.show(); - } - public FrameMenuTest() - { - super("FrameMenuTest"); - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) - { - dispose(); - System.exit(0); - } - }); - - MenuBar mbar = new MenuBar(); - Menu menu = new Menu("File"); - MenuItem exit = new MenuItem("Exit"); - menu.add(exit); - mbar.add(menu); - setMenuBar(mbar); - - exit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ev) { - dispose(); - System.exit(0); - }}); - - Label message = new Label("Choose File->Exit to continue"); - add(message, "Center"); - } -} diff --git a/libjava/classpath/testsuite/java.sun.awt/FrameTest.java b/libjava/classpath/testsuite/java.sun.awt/FrameTest.java deleted file mode 100644 index 02a2bef..0000000 --- a/libjava/classpath/testsuite/java.sun.awt/FrameTest.java +++ /dev/null @@ -1,32 +0,0 @@ -import java.awt.*; -import java.awt.event.*; - -public class FrameTest - extends Frame -{ - public static void main(String args[]) - { - FrameTest frame = new FrameTest(); - frame.pack(); - frame.show(); - } - public FrameTest() - { - super("FrameTest"); - Button done = new Button("Press to continue"); - add(done, "Center"); - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) - { - dispose(); - System.exit(0); - } - }); - done.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ev) { - dispose(); - System.exit(0); - }}); - - } -} diff --git a/libjava/classpath/testsuite/java.sun.awt/execute.exp b/libjava/classpath/testsuite/java.sun.awt/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.sun.awt/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.sun.tools/ClassPathTest.java b/libjava/classpath/testsuite/java.sun.tools/ClassPathTest.java deleted file mode 100644 index 9e17cc3..0000000 --- a/libjava/classpath/testsuite/java.sun.tools/ClassPathTest.java +++ /dev/null @@ -1,14 +0,0 @@ -import sun.tools.java.*; - -public class ClassPathTest { - public static void main(String args[]) { - ClassPath cp = - new ClassPath((String)System.getProperties().get("java.class.path")); - ClassFile cf = cp.getFile("ClassPathTest.class"); - try { - System.out.println("PASSED: "+cp.toString() +" "+ cf.toString()); - } catch (Exception e) { - System.out.println("FAILED: " + e.toString()); - } - } -} diff --git a/libjava/classpath/testsuite/java.sun.tools/JavacTest.java b/libjava/classpath/testsuite/java.sun.tools/JavacTest.java deleted file mode 100644 index b7ac524..0000000 --- a/libjava/classpath/testsuite/java.sun.tools/JavacTest.java +++ /dev/null @@ -1,22 +0,0 @@ -import java.lang.*; - -public class JavacTest { - - public static void main (String args[]) { - try { - - - sun.tools.javac.Main javac = new sun.tools.javac.Main(System.err, "javac"); - - String[] strarr = new String[1]; - strarr[0] = "java.sun.tools/JavacTest.java"; - - javac.compile(strarr); - - System.out.println("PASSED: javac worked"); - System.exit(0); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.sun.tools/execute.exp b/libjava/classpath/testsuite/java.sun.tools/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.sun.tools/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.text/MessageFormatTest.java b/libjava/classpath/testsuite/java.text/MessageFormatTest.java deleted file mode 100644 index 94efe94..0000000 --- a/libjava/classpath/testsuite/java.text/MessageFormatTest.java +++ /dev/null @@ -1,25 +0,0 @@ -import java.text.*; - -public class MessageFormatTest -{ - public static void main(String args[]) - { - try { - String[] sa = new String[3]; - String format = "{0}.{1}() {2}"; - - sa[0] = "MessageFormat"; - sa[1] = "format"; - sa[2] = "worked"; - - String message = MessageFormat.format(format, (Object[])sa); - - if (null == message) - throw new Exception("Unable to format message"); - - System.out.println("PASSED: " + message); - } catch (Exception e) { - System.out.println("FAILED: " + e); - } - } -} diff --git a/libjava/classpath/testsuite/java.text/SimpleDateFormatTest.java b/libjava/classpath/testsuite/java.text/SimpleDateFormatTest.java deleted file mode 100644 index 4bd8a5f..0000000 --- a/libjava/classpath/testsuite/java.text/SimpleDateFormatTest.java +++ /dev/null @@ -1,17 +0,0 @@ -import java.util.*; // for Date() -import java.text.*; - -public class SimpleDateFormatTest -{ - public static void main(String args[]) - { - try { - SimpleDateFormat formatter - = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); - Date current = new Date(); - System.out.println("PASSED: time="+formatter.format(current)); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.text/execute.exp b/libjava/classpath/testsuite/java.text/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.text/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/java.util/ResourceBundleTest.java b/libjava/classpath/testsuite/java.util/ResourceBundleTest.java deleted file mode 100644 index 5ad5ad6..0000000 --- a/libjava/classpath/testsuite/java.util/ResourceBundleTest.java +++ /dev/null @@ -1,20 +0,0 @@ -import java.util.*; - -public class ResourceBundleTest -{ - public static void main(String args[]) - { - try { - ResourceBundle messageRB = - ResourceBundle.getBundle("sun.tools.javac.resources.javac"); - - String bundle = (String)messageRB.getObject("main.usage"); - if (null == bundle) - throw new Exception("javac.main.usage resource is null"); - - System.out.println("PASSED: Resource javac.main.usage existed"); - } catch (Exception e) { - System.out.println("FAILED: " + e); - } - } -} diff --git a/libjava/classpath/testsuite/java.util/SimpleTimeZoneTest.java b/libjava/classpath/testsuite/java.util/SimpleTimeZoneTest.java deleted file mode 100644 index 1263c21..0000000 --- a/libjava/classpath/testsuite/java.util/SimpleTimeZoneTest.java +++ /dev/null @@ -1,14 +0,0 @@ -import java.util.*; - -public class SimpleTimeZoneTest -{ - public static void main(String args[]) - { - try { - SimpleTimeZone gmt = new SimpleTimeZone(0, "GMT"); - System.out.println("PASSED: timezone="+gmt.toString()); - } catch (Exception e) { - System.out.println("FAILED: "+e); - } - } -} diff --git a/libjava/classpath/testsuite/java.util/execute.exp b/libjava/classpath/testsuite/java.util/execute.exp deleted file mode 100644 index 1092485..0000000 --- a/libjava/classpath/testsuite/java.util/execute.exp +++ /dev/null @@ -1,7 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> - -# Load support procs -load_lib java.exp - -test-java-source diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/AllParserTests.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/AllParserTests.java deleted file mode 100644 index d4fca26..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/AllParserTests.java +++ /dev/null @@ -1,149 +0,0 @@ -/* AllParserTests.java -- The comprehensive HTML parser test. - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -import test.gnu.javax.swing.text.html.HTML_Test; -import test.gnu.javax.swing.text.html.parser.AttributeList_test; -import test.gnu.javax.swing.text.html.parser.DTD_test; -import test.gnu.javax.swing.text.html.parser.Element_Test; -import test.gnu.javax.swing.text.html.parser.Entity_Test; -import test.gnu.javax.swing.text.html.parser.HTML_parsing; -import test.gnu.javax.swing.text.html.parser.HTML_randomTable; -import test.gnu.javax.swing.text.html.parser.ParserEntityResolverTest; -import test.gnu.javax.swing.text.html.parser.TagElement_Test; -import test.gnu.javax.swing.text.html.parser.Text; -import test.gnu.javax.swing.text.html.parser.Token_locations; -import test.gnu.javax.swing.text.html.parser.parameterDefaulter_Test; -import test.gnu.javax.swing.text.html.parser.supplementaryNotifications; -import test.gnu.javax.swing.text.html.parser.textPreProcessor_Test; -import test.gnu.javax.swing.text.html.parser.low.Buffer_Test; -import test.gnu.javax.swing.text.html.parser.low.Constants_Test; -import test.gnu.javax.swing.text.html.parser.low.ReaderTokenizer_Test; - -/** - * This is a complete test for javax.swing.text.html.parser package. - * Apart javax.* classes, it also tests the implementation specific - * gnu.javax.* classes and in this way is more strict than - * Mauve tests. To avoid regression it is strongly recommended to run - * this test after you modify clases in javax.swing.text.html.parser or - * gnu.javax.swing.text.html.parser. - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class AllParserTests -{ - public static void main(String[] args) - { - try - { - HTML_Test a_HTML_Test = new HTML_Test(); - a_HTML_Test.testGetAttributeKey(); - a_HTML_Test.testGetIntegerAttributeValue(); - a_HTML_Test.testGetTag(); - a_HTML_Test.testCaseSensitivity(); - a_HTML_Test.testConstructor(); - - Buffer_Test a_Buffer_Test = new Buffer_Test(); - a_Buffer_Test.testDelete(); - a_Buffer_Test.testAppend(); - - Constants_Test a_Constants_Test = new Constants_Test(); - a_Constants_Test.testCases(); - - ReaderTokenizer_Test a_ReaderTokenizer_Test = - new ReaderTokenizer_Test(); - a_ReaderTokenizer_Test.testReadingAndAhead(); - a_ReaderTokenizer_Test.testComplexToken(); - - AttributeList_test a_AttributeList_test = new AttributeList_test(); - a_AttributeList_test.testSame(); - - DTD_test a_DTD_test = new DTD_test(); - a_DTD_test.testGetElement(); - - Element_Test a_Element_Test = new Element_Test(); - a_Element_Test.testName2type(); - a_Element_Test.testAttributeGetter(); - - Entity_Test a_Entity_Test = new Entity_Test(); - a_Entity_Test.testName2type(); - a_Entity_Test.testPublicSystemGeneralParameter(); - - HTML_parsing a_HTML_parsing = new HTML_parsing(); - a_HTML_parsing.testHTMLParsing(); - - HTML_randomTable a_HTML_randomTable = new HTML_randomTable(); - a_HTML_randomTable.testTableParsing(); - - parameterDefaulter_Test a_parameterDefaulter_Test = - new parameterDefaulter_Test(); - a_parameterDefaulter_Test.testDefaultValues(); - - ParserEntityResolverTest a_ParserEntityResolverTest = - new ParserEntityResolverTest(); - a_ParserEntityResolverTest.testResolver(); - - supplementaryNotifications a_supplementaryNotifications = - new supplementaryNotifications(); - a_supplementaryNotifications.testHTMLParsing(); - - TagElement_Test a_TagElement_Test = new TagElement_Test(); - a_TagElement_Test.testTagElement(); - - textPreProcessor_Test a_textPreProcessor_Test = - new textPreProcessor_Test(); - a_textPreProcessor_Test.testStandardPreProcessing(); - a_textPreProcessor_Test.testPreFormattedPreProcessing(); - - Text a_Text = new Text(); - a_Text.testTextParsing(); - - Token_locations a_Token_locations = new Token_locations(); - a_Token_locations.testHTMLParsing(); - } - catch (Exception ex) - { - System.err.println("The tests have FAILED.\nPlease either correct your " + - "changes\nor, if you are absolutely sure, correct the tests.\n" + - "See the following exception for details" - ); - ex.printStackTrace(System.err); - System.exit(1); - } - System.out.println("HTML parser tests have passed."); - System.exit(0); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java deleted file mode 100644 index 60247fd..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java +++ /dev/null @@ -1,130 +0,0 @@ -/* HTML_Test.java -- HTML parser test. - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html; - -import test.gnu.javax.swing.text.html.parser.TestCase; - -import javax.swing.text.SimpleAttributeSet; -import javax.swing.text.html.HTML; - -public class HTML_Test - extends TestCase -{ - /** - * By the language definition, HTML tags and attributes are case - * insensitive. Hence if it is not clearly specified, in which case - * the tag name must be, it should be expected to come as in - * lowercase, as in uppercase. This should be true for HTML.getTag(String) - * and for HTML.getAttributeKey(String). - * - * In some implementations these two functions may be case sensitive. - * As this requirement is not mentioned in the documentation, - * and also it is not documented, in which case the name must be supplied, - * this will be reported as an error in this test. - * The GNU CLASSPATH implementation is case insensitive. - */ - public void testCaseSensitivity() - { - String def = "case sensitivity"; - assertEquals("html=Html", HTML.getTag("html"), HTML.getTag("HtmL")); - assertEquals("html=HTML", HTML.getTag("html"), HTML.getTag("HTML")); - assertEquals("size=SIZE", HTML.getAttributeKey("size"), - HTML.getAttributeKey("SIZE") - ); - assertEquals("size=SizE", HTML.getAttributeKey("size"), - HTML.getAttributeKey("SizE") - ); - } - - public void testConstructor() - { - new HTML(); - } - - public void testGetAttributeKey() - { - // Test the known tags. - String[] mine = toStrings(HTML.getAllAttributeKeys()); - - for (int i = 0; i < mine.length; i++) - assertNotNull(mine [ i ], HTML.getAttributeKey(mine [ i ])); - - // Test the unknown tag. - assertNull("surely unknown", HTML.getTag("audrius")); - } - - public void testGetIntegerAttributeValue() - { - SimpleAttributeSet ase = new SimpleAttributeSet(); - ase.addAttribute(HTML.getAttributeKey("size"), "222"); - assertEquals(222, - HTML.getIntegerAttributeValue(ase, - HTML.getAttributeKey("size"), 333 - ) - ); - - assertEquals(333, - HTML.getIntegerAttributeValue(ase, - HTML.getAttributeKey("href"), 333 - ) - ); - } - - public void testGetTag() - { - // known tags: - String[] mine = toStrings(HTML.getAllTags()); - - for (int i = 0; i < mine.length; i++) - assertNotNull(mine [ i ], HTML.getTag(mine [ i ])); - - // unknown tag - assertNull("surely unknown", HTML.getTag("audrius")); - } - - private String[] toStrings(Object[] objs) - { - String[] a = new String[ objs.length ]; - - for (int i = 0; i < a.length; i++) - a [ i ] = objs [ i ].toString(); - - return a; - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java deleted file mode 100644 index 3166277..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java +++ /dev/null @@ -1,68 +0,0 @@ -/* AttributeList_test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.html.parser.AttributeList; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class AttributeList_test - extends TestCase -{ - private AttributeList attributeList = null; - - public void testSame() - { - for (int i = 0; i < 100; i++) - { - String t = AttributeList.type2name(i); - if (t != null) - assertEquals(i, AttributeList.name2type(t)); - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - attributeList = new AttributeList("ku"); - assertEquals(attributeList.toString(), "ku"); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java deleted file mode 100644 index b204a024..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java +++ /dev/null @@ -1,102 +0,0 @@ -/* DTD_test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.html.HTML; -import javax.swing.text.html.parser.DTD; -import javax.swing.text.html.parser.Element; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class DTD_test - extends TestCase -{ - static class D - extends DTD - { - public D() - { - super("audrius"); - } - - public Element createElement(String n) - { - return getElement(n); - } - } - - public void testGetElement() - { - D d = new D(); - HTML.Tag[] tags = HTML.getAllTags(); - - Element prehead = d.createElement("head"); - - for (int i = 0; i < tags.length; i++) - { - Element e = d.createElement(tags [ i ].toString()); - String name = tags [ i ].toString(); - assertNotNull("Element creation", e); - assertTrue("Element name", e.getName().equalsIgnoreCase(name)); - } - - // Test upper/lowercase - Element e = d.createElement("head"); - - assertNotNull("Element creation", e); - assertTrue("Element name", e.getName().equalsIgnoreCase("head")); - assertEquals(HTML.Tag.HEAD, HTML.getTag(e.name)); - assertEquals("Field assignment", d.head, e); - - assertEquals(prehead, e); - } - - protected void setUp() - throws Exception - { - super.setUp(); - } - - protected void tearDown() - throws Exception - { - super.tearDown(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java deleted file mode 100644 index 039be4a..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Element_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.html.parser.AttributeList; -import javax.swing.text.html.parser.DTD; -import javax.swing.text.html.parser.DTDConstants; -import javax.swing.text.html.parser.Element; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Element_Test - extends TestCase -{ - private Element element = null; - - public void testAttributeGetter() - throws Exception - { - // Create a chain of 24 attributes: - AttributeList list = new AttributeList("heading"); - AttributeList head = list; - list.value = null; - for (int i = 0; i < 24; i++) - { - AttributeList a = new AttributeList("a" + i); - a.value = "v" + i; - list.next = a; - list = a; - } - - Element e = DTD.getDTD("test").getElement("e"); - e.atts = head; - - for (int i = 0; i < 24; i++) - { - // Check if the name is found. - assertEquals(e.getAttribute("a" + i).toString(), "a" + i); - - // Check if the attribute value is correct. - assertEquals(e.getAttribute("a" + i).value, "v" + i); - - // Check if the attribute can be found by value. - assertEquals(e.getAttributeByValue("v" + i).name, "a" + i); - } - - // Check is the null value is searched correctly. - assertEquals(e.getAttributeByValue(null).toString(), "heading"); - - // Check for unknown attribute - assertEquals(e.getAttribute("audrius"), null); - - // Check for unknown value - assertEquals(e.getAttributeByValue("audrius"), null); - } - - public void testName2type() - { - assertEquals(Element.name2type("CDATA"), DTDConstants.CDATA); - assertEquals(Element.name2type("RCDATA"), DTDConstants.RCDATA); - assertEquals(Element.name2type("EMPTY"), DTDConstants.EMPTY); - assertEquals(Element.name2type("ANY"), DTDConstants.ANY); - - assertEquals(Element.name2type("audrius"), 0); - assertEquals(Element.name2type("rcdata"), 0); - } - - protected void setUp() - throws Exception - { - super.setUp(); - } - - protected void tearDown() - throws Exception - { - element = null; - super.tearDown(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java deleted file mode 100644 index b9fd21c..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Entity_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.html.parser.DTDConstants; -import javax.swing.text.html.parser.Element; -import javax.swing.text.html.parser.Entity; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Entity_Test - extends TestCase -{ - private Element element = null; - - public void testName2type() - { - assertEquals("PUBLIC", Entity.name2type("PUBLIC"), DTDConstants.PUBLIC); - assertEquals("SDATA", Entity.name2type("SDATA"), DTDConstants.SDATA); - assertEquals("PI", Entity.name2type("PI"), DTDConstants.PI); - assertEquals("STARTTAG", Entity.name2type("STARTTAG"), DTDConstants.STARTTAG); - assertEquals("ENDTAG", Entity.name2type("ENDTAG"), DTDConstants.ENDTAG); - assertEquals("MS", Entity.name2type("MS"), DTDConstants.MS); - assertEquals("MD", Entity.name2type("MD"), DTDConstants.MD); - assertEquals("SYSTEM", Entity.name2type("SYSTEM"), DTDConstants.SYSTEM); - - assertEquals("surely unknown ", Entity.name2type("audrius"), - DTDConstants.CDATA - ); - } - - public void testPublicSystemGeneralParameter() - { - int[] pu_sy = new int[] { DTDConstants.PUBLIC, DTDConstants.SYSTEM, 0 }; - - int[] gen_par = - new int[] { DTDConstants.GENERAL, DTDConstants.PARAMETER, 0 }; - - for (int ps = 0; ps < pu_sy.length; ps++) - { - for (int gp = 0; gp < gen_par.length; gp++) - { - Entity e = new Entity(null, 0, null); - e.type = pu_sy [ ps ] | gen_par [ gp ]; - - assertEquals(e.isGeneral(), gen_par [ gp ] == DTDConstants.GENERAL); - assertEquals(e.isParameter(), - gen_par [ gp ] == DTDConstants.PARAMETER - ); - - assertEquals((e.type & DTDConstants.SYSTEM) != 0, - pu_sy [ ps ] == DTDConstants.SYSTEM - ); - - assertEquals((e.type & DTDConstants.PUBLIC) != 0, - pu_sy [ ps ] == DTDConstants.PUBLIC - ); - - assertEquals((e.type & DTDConstants.GENERAL) != 0, - gen_par [ gp ] == DTDConstants.GENERAL - ); - - assertEquals((e.type & DTDConstants.PARAMETER) != 0, - gen_par [ gp ] == DTDConstants.PARAMETER - ); - } - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - } - - protected void tearDown() - throws Exception - { - element = null; - super.tearDown(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java deleted file mode 100644 index 3072385..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java +++ /dev/null @@ -1,281 +0,0 @@ -/* HTML_parsing.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class HTML_parsing - extends TestCase -{ - /** - * This is used for profiling. - */ - public static void main(String[] args) - { - long t = System.currentTimeMillis(); - try - { - HTML_parsing p = new HTML_parsing(); - for (int i = 0; i < 2000; i++) - { - p.testHTMLParsing(); - if (i % 10 == 0) - System.out.print('.'); - } - } - catch (Exception ex) - { - } - System.out.println("TIME " + (System.currentTimeMillis() - t)); - } - - public void testHTMLParsing() - throws Exception - { - Parser_Test v = new Parser_Test(); - v.hideImplied = false; - - // Test subsequent tags. - v.verify("<b><i><u>text</b><i></u>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><b><i><u>'text'</b><i></u></i></i></body></html>" - ); - - // Test entities. - v.verify("hex: U eqdec: = ampnamed: &", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'hex: U eqdec: = ampnamed: &'</body></html>" - ); - - // Test comments. - v.verify("<html><head></head><body><!--a-->< !--b--><! --c--><!-- d--><!--e --><!--f-- ><!--g--><!---h---><!-- i --><!--- j ---><!-- -- --> <b> <!---------->", - "<html><head></head><body>{a}{b}{c}{ d}{e }{f}{g}{-h-}{ i }{- j -}{ -- }<b>{------}</b></body></html>" - ); - - // Test unclosed tags. - v.verify("<hr id = 1 class = c<hr id=2>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='c' id='1'/><hr id='2'/></body></html>" - ); - - // Test errors and unclosed tags. - v.verify("<b#r><hr id = 1 # class = c<hr id=2>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><b><hr id='1'/>'# class = c'<hr id='2'/></b></body></html>" - ); - - // Test script. - v.verify("<hr id=1><script a=b c=d><hr id=1></script><hr id=1>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr id='1'/><script a='b' c='d'>'<hr id=1>'</script><hr id='1'/></body></html>" - ); - - // Test valid attributes. - v.verify("<hr id='i' title=\"tit\" class=cl><hr><hr id = 2>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='cl' id='i' title='tit'/><hr/><hr id='2'/></body></html>" - ); - - // Test unknown attribute without value. - v.verify("<hr audrius title=\"tit\">", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr audrius='#DEFAULT' title='tit'/></body></html>" - ); - - // Test known attributes witout value. - v.verify("<option id=a selected><option id=b selected = selected class=cC><input checked>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><option id='a' selected='selected'></option></body><body _implied_='true'><option class='cC' id='b' selected='selected'></option><input checked='checked'/></body></html>" - ); - - // Test table content model. - v.verify("<table>a</table>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'a'</td></tr></tbody></table></body></html>" - ); - - // Test table content model. - v.verify("<table><caption>cap</caption>a</table>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><caption>'cap'</caption><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'a'</td></tr></tbody></table></body></html>" - ); - - // Test typical table. - v.verify("<table><tr><td>x</td><td>y</td><td>z</td></table>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'x'</td><td>'y'</td><td>'z'</td></tr></tbody></table></body></html>" - ); - - // Test nested table. - v.verify("<table><tr><td><table>nested</table>x</td><td>y</td><td>z</td></table>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td><table><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'nested'</td></tr></tbody></table>'x'</td><td>'y'</td><td>'z'</td></tr></tbody></table></body></html>" - ); - - // Test simple nested list. - v.verify("<ul><li>a</li><ul><li>na</li><li>nb</li></ul><li>b</li></ul>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><ul><li>'na'</li><li>'nb'</li></ul><li>'b'</li></ul></body></html>" - ); - - // Test simple non-nested list. - v.verify("<ul><li>a</li><li>na</li><li>nb</li><li>b</li></ul>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><li>'na'</li><li>'nb'</li><li>'b'</li></ul></body></html>" - ); - - // Test list without closing tags (obsolete list form). - v.verify("<ul><li>a<li>na<li>nb<li>b</ul>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><li>'na'</li><li>'nb'</li><li>'b'</li></ul></body></html>" - ); - - // Test list without closing tags (obsolete list form). - v.verify("<ul><li>a<ul><li>na<li>nb</ul><li>b</ul>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'<ul><li>'na'</li><li>'nb'</li></ul></li><li>'b'</li></ul></body></html>" - ); - - // Test Obsolete table. - v.verify("<table><tr><td>a<td>b<td>c</tr>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td><td>'b'</td><td>'c'</td></tr></tbody></table></body></html>" - ); - - // Test html no head no body. - v.verify("<html>text</html>", - "<html><head _implied_='true'></head><body _implied_='true'>'text'</body></html>" - ); - - // Test head only. - v.verify("<head></head>text", - "<html _implied_='true'><head></head><body _implied_='true'>'text'</body></html>" - ); - - // Test head and body. - v.verify("<head><title>ti</title></head><body>text", - "<html _implied_='true'><head><title>'ti'</title></head><body>'text'</body></html>" - ); - - // Test title and text. - v.verify("<title>title</title>text", - "<html _implied_='true'><head _implied_='true'><title>'title'</title></head><body _implied_='true'>'text'</body></html>" - ); - - // Test html only. - v.verify("<html>text</html>", - "<html><head _implied_='true'></head><body _implied_='true'>'text'</body></html>" - ); - - // Test body only. - v.verify("<body>text</body>", - "<html _implied_='true'><head _implied_='true'></head><body>'text'</body></html>" - ); - - // Test head only. - v.verify("<head></head>text", - "<html _implied_='true'><head></head><body _implied_='true'>'text'</body></html>" - ); - - // Test obsolete table. - v.verify("<table><tr><td>a</td><tr><td>a</td>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td></tr><tr><td>'a'</td></tr></tbody></table></body></html>" - ); - - // Test obsolete table. - v.verify("<table><tr><td>a<td>b<tr><td>a<td>b<td>c", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td><td>'b'</td></tr><tr><td>'a'</td><td>'b'</td><td>'c'</td></tr></tbody></table></body></html>" - ); - - // Test style. - v.verify("<html><head><style><hr id=2></style></head><hr id = b>", - "<html><head><style>'<hr id=2>'</style></head><body _implied_='true'><hr id='b'/></body></html>" - ); - - // Test style. - v.verify("<style><hr id=2></style>x", - "<html _implied_='true'><head _implied_='true'><style>'<hr id=2>'</style></head><body _implied_='true'>'x'</body></html>" - ); - - // Test entities in attributes. - v.verify("<hr id='id_AZ' class= \"Y_&\" >", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='Y_&' id='id_AZ'/></body></html>" - ); - - // Test colgroup. - v.verify("<table><COLGROUP width=\"25\"><COL span=\"45\"><COL id=\"identifier\"></COLGROUP><td>a<td>b<tr>x", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><colgroup width='25'><col span='45'/><col id='identifier'/></colgroup><tbody _implied_='true'><tr _implied_='true'><td>'a'</td><td>'b'</td></tr><tr><td _implied_='true'>'x'</td></tr></tbody></table></body></html>" - ); - - // Test definition list, obsolete. - v.verify("<dl><dt>ha<dd>a<dt>hb<dd>b", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><dl><dt>'ha'</dt><dd>'a'</dd><dt>'hb'</dt><dd>'b'</dd></dl></body></html>" - ); - - // Test definition list. - v.verify("<html><head></head><body><dl><dt>'ha'</dt><dd>'a'</dd><dt>'hb'</dt><dd>'b'</dd></dl></body></html>", - "<html><head></head><body><dl><dt>''ha''</dt><dd>''a''</dd><dt>''hb''</dt><dd>''b''</dd></dl></body></html>" - ); - - // Test paragraphs. - v.verify("<p>b<p>c<p>d", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><p>'b'</p><p>'c'</p><p>'d'</p></body></html>" - ); - - // Test paragraphs. - v.verify("<p>'b'</p><p>'c'</p><p>'d'</p>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><p>''b''</p><p>''c''</p><p>''d''</p></body></html>" - ); - - // Test select obsolete. - v.verify("<form><select><option value='hi' disabled>a<option selected>b<option>normal", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option disabled='disabled' value='hi'>'a'</option><option selected='selected'>'b'</option><option>'normal'</option></select></form></body></html>" - ); - - // Test select current. - v.verify("<form><select><option>'a'</option><option SELECTED='selected'>'b'</option></select></form>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option>''a''</option><option selected='selected'>''b''</option></select></form></body></html>" - ); - - // Test select current. - v.verify("<form><select><option>after<optgroup><option>'a'</option><option SELECTED='selected'>'b'</option></optgroup></select></form>", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option>'after'</option><optgroup><option>''a''</option><option selected='selected'>''b''</option></optgroup></select></form></body></html>" - ); - - // Test << antihang. - v.verify("<<i>text", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'<'<i>'text'</i></body></html>" - ); - - // Test << antihang with spaces. - v.verify(" < < i>text", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'<'<i>'text'</i></body></html>" - ); - - // Test Standalone <. - v.verify("Text <wrong tag is it! <b> text ", - "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'Text''<wrong tag is it!'<b>'text'</b></body></html>" - ); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java deleted file mode 100644 index d7a52b5..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java +++ /dev/null @@ -1,155 +0,0 @@ -/* HTML_randomTable.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import java.util.Random; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class HTML_randomTable - extends TestCase -{ - class table - { - final String[][] rows; - final boolean caption = r.nextBoolean(); - - table() - { - int nrows = r.nextInt(5) + 1; - rows = new String[ nrows ][]; - for (int i = 0; i < rows.length; i++) - { - int ncol = r.nextInt(5) + 1; - rows [ i ] = new String[ ncol ]; - for (int j = 0; j < rows [ i ].length; j++) - { - rows [ i ] [ j ] = "C_" + i + "_" + j; - } - } - } - - public String getHtml() - { - StringBuffer b = new StringBuffer("<html><head></head><body><table>"); - if (caption) - b.append("<caption>capt</caption>"); - if (r.nextBoolean()) - b.append("<" + s() + "tbody" + s() + ">"); - for (int row = 0; row < rows.length; row++) - { - b.append("<" + s() + "tr" + s() + ">"); - for (int col = 0; col < rows [ row ].length; col++) - { - b.append("<" + s() + "td" + s() + ">"); - b.append(rows [ row ] [ col ]); - if (r.nextBoolean()) - b.append("<" + s() + "/" + "td" + s() + ">"); - } - if (r.nextBoolean()) - b.append("<" + s() + "/" + "tr" + s() + ">"); - } - b.append("</tbody></table></body></html>"); - return b.toString(); - } - - public String getTrace() - { - StringBuffer b = new StringBuffer("<html><head></head><body><table>"); - if (caption) - b.append("<caption>'capt'</caption>"); - b.append("<tbody>"); - for (int row = 0; row < rows.length; row++) - { - b.append("<tr>"); - for (int col = 0; col < rows [ row ].length; col++) - { - b.append("<td>'" + rows [ row ] [ col ] + "'</td>"); - } - b.append("</tr>"); - } - b.append("</tbody></table></body></html>"); - return b.toString(); - } - - void test() - throws Exception - { - String trace = getTrace(); - String html = getHtml(); - v.verify(html, trace); - } - } - - Parser_Test v = new Parser_Test(); - Random r = new Random(); - - public HTML_randomTable() - throws Exception - { - } - - public String s() - { - if (r.nextBoolean()) - return ""; - - StringBuffer b = new StringBuffer(); - int spc = r.nextInt(4); - for (int i = 0; i < spc; i++) - { - b.append(' '); - } - return b.toString(); - } - - /** - * Try 1001 variable randomly generated table. - */ - public void testTableParsing() - throws Exception - { - v.hideImplied = true; - for (int i = 0; i < 1001; i++) - { - new table().test(); - } - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java deleted file mode 100644 index 414aadc..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* ParserEntityResolverTest.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import gnu.javax.swing.text.html.parser.HTML_401F; -import gnu.javax.swing.text.html.parser.support.Parser; - -import java.lang.reflect.Method; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class ParserEntityResolverTest - extends TestCase -{ - /* Testing private methods of entity resolver. */ - public void testResolver() - throws Exception - { - Parser p = - new Parser(HTML_401F.getInstance()) - { - public void error(String a, String b) - { - } - }; - - Method rn = - p.getClass().getSuperclass().getDeclaredMethod("resolveNamedEntity", - new Class[] { String.class } - ); - rn.setAccessible(true); - - assertEquals(exe(p, rn, "&"), "&"); - assertEquals(exe(p, rn, "&"), "&"); - assertEquals(exe(p, rn, "&"), "&"); - assertEquals(exe(p, rn, "&amP"), "&"); - - assertEquals(exe(p, rn, "&;"), "&;"); - assertEquals(exe(p, rn, "&audrius;"), "&audrius;"); - - rn = - p.getClass().getSuperclass().getDeclaredMethod("resolveNumericEntity", - new Class[] { String.class } - ); - rn.setAccessible(true); - - assertEquals(exe(p, rn, "U"), "U"); - assertEquals(exe(p, rn, "U"), "U"); - assertEquals(exe(p, rn, "="), "="); - assertEquals(exe(p, rn, "="), "="); - - assertEquals(exe(p, rn, "&#audrius"), "?"); - } - - private String exe(Parser p, Method m, String arg) - throws Exception - { - Object[] o = new Object[ 1 ]; - o [ 0 ] = arg; - return m.invoke(p, o).toString(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java deleted file mode 100644 index af12cbb..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* ParserTest.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import gnu.javax.swing.text.html.parser.support.Parser; - -import java.io.PrintStream; - -import java.util.Enumeration; - -import javax.swing.text.AttributeSet; -import javax.swing.text.html.parser.Element; -import javax.swing.text.html.parser.TagElement; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class ParserTest - extends gnu.javax.swing.text.html.parser.support.Parser -{ - PrintStream out = System.out; - StringBuffer errors = new StringBuffer(); - - public ParserTest() - { - super(gnu.javax.swing.text.html.parser.HTML_401F.getInstance()); - } - - public static void main(String[] args) - { - String sx; - sx = - "<html><head></head><body><table>< tbody><tr >< td >C_0_0< td>C_0_1< td >C_0_2< /td >< td >C_0_3<td>C_0_4< /td></tr ></tbody></table></body></html>"; - try - { - System.out.println(sx); - - ParserTest t = new ParserTest(); - t.parse(new java.io.StringReader(sx)); - System.out.println("\nErrors:"); - System.out.println(t.errors); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - protected void handleComment(char[] parm1) - { - out.print("{" + new String(parm1) + "}"); - } - - protected void handleEOFInComment() - { - out.print(" [EOF in comment] "); - } - - protected void handleEmptyTag(TagElement tag) - throws javax.swing.text.ChangedCharSetException - { - out.print("<" + tag); - - javax.swing.text.AttributeSet atts = getAttributes(); - dumpAttributes(atts); - out.print("/>"); - } - - protected void handleEndTag(TagElement tag) - { - out.print("</" + tag + "> "); - } - - protected void handleError(int line, String message) - { - errors.append(message); - errors.append('\n'); - } - - protected void handleStartTag(TagElement tag) - { - out.print("<" + tag); - - javax.swing.text.AttributeSet atts = getAttributes(); - dumpAttributes(atts); - out.print('>'); - } - - protected void handleText(char[] parm1) - { - out.print("'" + new String(parm1) + "'"); - } - - protected void handleTitle(char[] parm1) - { - out.print(" [ Title: " + new String(parm1) + "] "); - } - - protected void markFirstTime(Element element) - { - out.print("(1:" + element + ")"); - } - - private void dumpAttributes(AttributeSet atts) - { - Enumeration enum = atts.getAttributeNames(); - while (enum.hasMoreElements()) - { - String a = enum.nextElement().toString(); - String v = (String) atts.getAttribute(a); - out.print(" " + a + "='" + v + "'"); - } - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java deleted file mode 100644 index c3ba38a..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java +++ /dev/null @@ -1,162 +0,0 @@ -/* Parser_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - - -package test.gnu.javax.swing.text.html.parser; - -import java.io.StringReader; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.TreeSet; - -import javax.swing.text.AttributeSet; -import javax.swing.text.MutableAttributeSet; -import javax.swing.text.SimpleAttributeSet; -import javax.swing.text.html.HTML; -import javax.swing.text.html.HTMLEditorKit; -import javax.swing.text.html.HTMLEditorKit.ParserCallback; -import javax.swing.text.html.parser.ParserDelegator; -import javax.swing.text.html.parser.TagElement; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Parser_Test - extends HTMLEditorKit.ParserCallback -{ - public boolean hideImplied = true; - protected StringBuffer out = new StringBuffer(); - AttributeSet atts = new SimpleAttributeSet(); - - public void generate(String x, String comment) - throws Exception - { - String prolog = "<html><head></head><body>"; - String epilog = "</body></html>"; - String html = x; // prolog+x+epilog; - System.out.println("// Test " + comment + "."); - System.out.println("v.verify(\"" + html + "\",\n \"" + verify(html, null) + - "\");" - ); - } - - public void handleComment(char[] parm1, int position) - { - out.append("{" + new String(parm1) + "}"); - } - - public void handleEndTag(HTML.Tag tag, int position) - { - out.append("</" + tag + ">"); - } - - public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, - int position - ) - { - if (tag.toString().equals("#pcdata")) - return; - out.append("<" + tag); - dumpAttributes(attributes); - out.append("/>"); - } - - public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributes, - int position - ) - { - out.append("<" + tag); - dumpAttributes(attributes); - out.append('>'); - } - - public void handleText(char[] chars, int position) - { - out.append("'" + new String(chars) + "'"); - } - - public String verify(String html, String trace) - throws Exception - { - out.setLength(0); - - HTMLEditorKit.ParserCallback callback = this; - ParserDelegator delegator = new ParserDelegator(); - delegator.parse(new StringReader(html), callback, true); - - String ou = out.toString(); - if (trace != null) - { - if (!ou.equals(trace)) - { - System.err.println("Unable to parse '" + html + "':"); - System.err.println(" expected: '" + trace + "',"); - System.out.println(" returned: '" + ou + "'."); - throw new Exception("'" + html + "' -> '" + ou + "' expected '" + - trace + "'" - ); - } - } - return ou; - } - - protected void dumpAttributes(AttributeSet atts) - { - Enumeration enum = atts.getAttributeNames(); - - // Sort them to ensure the same order every time: - TreeSet t = new TreeSet(); - while (enum.hasMoreElements()) - t.add(enum.nextElement().toString()); - - Iterator iter = t.iterator(); - - while (iter.hasNext()) - { - String a = iter.next().toString(); - - if (hideImplied) - if (a.equals("_implied_")) - continue; - - String v = atts.getAttribute(a).toString(); - out.append(" " + a + "='" + v + "'"); - } - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java deleted file mode 100644 index 12c07cf..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java +++ /dev/null @@ -1,87 +0,0 @@ -/* TagElement_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.html.HTML; -import javax.swing.text.html.parser.DTD; -import javax.swing.text.html.parser.Element; -import javax.swing.text.html.parser.TagElement; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class TagElement_Test - extends TestCase -{ - public void testTagElement() - throws Exception - { - HTML.Tag[] tags = HTML.getAllTags(); - - for (int i = 0; i < tags.length; i++) - { - HTML.Tag t = tags [ i ]; - String tn = t.toString(); - Element e = DTD.getDTD("test").getElement("e"); - e.name = tn; - - TagElement te = new TagElement(e, true); - assertTrue(" must be fictional", te.fictional()); - - te = new TagElement(e); - assertFalse("must be non fictional", te.fictional()); - - assertEquals(te.getHTMLTag().toString(), t.toString()); - assertEquals(t.breaksFlow(), te.breaksFlow()); - assertEquals(t.isPreformatted(), te.isPreformatted()); - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - } - - protected void tearDown() - throws Exception - { - super.tearDown(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java deleted file mode 100644 index 84c1603..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java +++ /dev/null @@ -1,138 +0,0 @@ -/* TestCase.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class TestCase -{ - public TestCase() - { - try - { - setUp(); - } - catch (Exception ex) - { - throw new RuntimeException(ex); - } - } - - public void assertEquals(String msg, Object a, Object b) - { - if (a == b) - return; - if (!a.equals(b)) - throw new RuntimeException(msg); - } - - public void assertEquals(Object a, Object b) - { - if (a == b) - return; - if (!a.equals(b)) - throw new RuntimeException("Objects must be equal"); - } - - public void assertEquals(int a, int b) - { - if (a != b) - throw new RuntimeException(a + "!=" + b); - } - - public void assertEquals(String msg, int a, int b) - { - if (a != b) - throw new RuntimeException(msg + ":" + a + "!=" + b); - } - - public void assertEquals(boolean a, boolean b) - { - if (a != b) - throw new RuntimeException(a + "!=" + b); - } - - public void assertFalse(String msg, boolean a) - { - if (a) - throw new RuntimeException(msg); - } - - public void assertFalse(boolean a) - { - if (a) - throw new RuntimeException("Must be false"); - } - - public void assertNotNull(String msg, Object a) - { - if (a == null) - throw new RuntimeException(msg); - } - - public void assertNull(String msg, Object a) - { - if (a != null) - throw new RuntimeException(msg); - } - - public void assertTrue(String msg, boolean a) - { - if (!a) - throw new RuntimeException(msg); - } - - public void assertTrue(boolean a) - { - if (!a) - throw new RuntimeException("Must be true"); - } - - protected void setUp() - throws Exception - { - } - - protected void tearDown() - throws Exception - { - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java deleted file mode 100644 index 9fe592a..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java +++ /dev/null @@ -1,155 +0,0 @@ -/* Text.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.MutableAttributeSet; -import javax.swing.text.html.HTML; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Text - extends TestCase -{ - public void testTextParsing() - throws Exception - { - Parser_Test v = - new Parser_Test() - { - public void handleSimpleTag(HTML.Tag tag, - MutableAttributeSet attributes, int position - ) - { - if (!tag.toString().equalsIgnoreCase("#pcdata")) - out.append("<" + tag + ">"); - } - - public void handleStartTag(HTML.Tag tag, - MutableAttributeSet attributes, int position - ) - { - out.append("<" + tag + ">"); - } - - public void handleText(char[] chars, int position) - { - for (int i = 0; i < chars.length; i++) - { - out.append(Integer.toHexString(chars [ i ])); - if (chars [ i ] > ' ') - out.append("'" + chars [ i ]); - out.append(" "); - } - } - - public void handleEndTag(HTML.Tag tag, int position) - { - out.append("</" + tag + ">"); - } - }; - - v.hideImplied = true; - - // NON - preformatted mode: - // Everything mutates into spaces, multiple spaces mustates - // into single one, all whitespace around tags is consumed. - v.verify("\r \n \t {abc r\rn\nt}\t \r\n \r \t", - "<html><head></head><body>7b'{ 61'a 62'b 63'c 20 72'r 20" + - " 6e'n 20 74't 7d'} </body></html>" - ); - - v.verify(" abba ", - "<html><head></head><body>61'a 62'b 62'b 61'a </body></html>" - ); - - v.verify(" \r ab \t \r \n ba ", - "<html><head></head><body>61'a 62'b 20 62'b 61'a </body></html>" - ); - - // Preformatted mode (in PRE tag): - // Heading/closing spaces and tabs preserve. ONE \r, \n or \r\n is removed. - // /r mutates into \n - v.verify("<pre>\n\n\n\n abba \r\t \r\n</pre>", - "<html><head></head><body><pre>a a a 20 20 20 61'a 62'b 62'b" + - " 61'a 20 20 20 a 9 20 </pre></body></html>" - ); - - v.verify("<pre> abba </pre>", - "<html><head></head><body><pre>20 20 20 61'a 62'b 62'b 61'a 20 " + - "20 20 </pre></body></html>" - ); - - v.verify("<pre>\r\n abba </pre>", - "<html><head></head><body><pre>20 20 20 61'a 62'b 62'b 61'a 20 " + - "20 20 </pre></body></html>" - ); - - v.verify("<pre>\r\n\r\n abba \r\n</pre>", - "<html><head></head><body><pre>a 20 20 20 61'a 62'b 62'b 61'a 20 20" + - " 20 </pre></body></html>" - ); - - v.verify("<pre> \r ab \t \r \n ba </pre>", - "<html><head></head><body><pre>20 a 20 61'a 62'b 20 20 9 20 a" + - " 20 a 20 20 62'b 61'a 20 20 20 </pre></body></html>" - ); - - v.verify("<pre> \r\n ab \t \r\n \n ba </pre>", - "<html><head></head><body><pre>20 a 20 61'a 62'b 20 20 9 20 a" + - " 20 a 20 20 62'b 61'a 20 20 20 </pre></body></html>" - ); - - // In TEXTAREA tag, same. - v.verify("<textarea>\n\n\n\n abba \r\n</textarea>", - "<html><head></head><body><textarea>a a a 20 20 20 61'a " + - "62'b 62'b 61'a 20 </textarea></body></html>" - ); - - v.verify("<textarea> abba </textarea>", - "<html><head></head><body><textarea>20 20 20 61'a 62'b 62'b 61'a 20 " + - "20 20 </textarea></body></html>" - ); - - v.verify("<textarea> \r ab \t \r \n ba </textarea>", - "<html><head></head><body><textarea>20 a 20 61'a 62'b 20 20 9 20 a" + - " 20 a 20 20 62'b 61'a 20 20 20 </textarea></body></html>" - ); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java deleted file mode 100644 index 8cbcaad..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java +++ /dev/null @@ -1,124 +0,0 @@ -/* Token_locations.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.MutableAttributeSet; -import javax.swing.text.html.HTML; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Token_locations - extends TestCase -{ - public void testHTMLParsing() - throws Exception - { - Parser_Test v = - new Parser_Test() - { - public void handleSimpleTag(HTML.Tag tag, - MutableAttributeSet attributes, int position - ) - { - if (tag.toString().equals("#pcdata")) - return; - out.append("<" + tag + "[" + position + "]"); - dumpAttributes(attributes); - out.append("/>"); - } - - public void handleStartTag(HTML.Tag tag, - MutableAttributeSet attributes, int position - ) - { - if (tag.toString().equalsIgnoreCase("tbody")) - return; - out.append("<" + tag + "[" + position + "]"); - dumpAttributes(attributes); - out.append('>'); - } - - public void handleText(char[] chars, int position) - { - out.append("'" + new String(chars) + "[" + position + "]'"); - } - - public void handleEndTag(HTML.Tag tag, int position) - { - if (tag.toString().equalsIgnoreCase("tbody")) - return; - out.append("</" + tag + "[" + position + "]>"); - } - - public void handleComment(char[] parm1, int position) - { - out.append("{" + new String(parm1) + "[" + position + "]}"); - } - }; - - v.hideImplied = true; - - // 0123456789012345678901234567890 - v.verify("<table><tr><td>a<td>b<td>c</tr>", - "<html[0]><head[0]></head[0]><body[0]><table[0]>" + - "<tr[7]><td[11]>'a[15]'</td[16]><td[16]>'b[20]'</td[21]>" + - "<td[21]>'c[25]'</td[26]></tr[26]></table[26]></body[26]>" + - "</html[26]>" - ); - - // 0123456789012345678901234567890 - v.verify("a<!-- comment -->b<!-- comment2 -->", - "<html[0]><head[0]></head[0]><body[0]>'a[0]'{ comment [1]}'b[17]'" + - "{ comment2 [18]}</body[18]></html[18]>" - ); - - // 012345678901234567 - v.verify("<p>b<p>c<p>d", - "<html[0]><head[0]></head[0]><body[0]><p[0]>'b[3]'</p[4]><p[4]>'" + - "c[7]'</p[8]><p[8]>'d[11]'</p[11]></body[11]></html[11]>" - ); - - // Test SGML - v.verify("<! the sgml construct >sgml", - "<html[23]><head[23]></head[23]><body[23]>" + - "'sgml[23]'</body[23]></html[23]>" - ); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java deleted file mode 100644 index 49d86c6..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java +++ /dev/null @@ -1,67 +0,0 @@ -/* Buffer_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser.low; - -import test.gnu.javax.swing.text.html.parser.TestCase; - -import gnu.javax.swing.text.html.parser.support.low.Buffer; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Buffer_Test - extends TestCase -{ - public void testAppend() - { - Buffer.INITIAL_SIZE = 2; - - Buffer b = new Buffer("01"); - b.append('A', 0); - b.append('B', 0); - assertEquals(b.toString(), "01AB"); - } - - public void testDelete() - { - Buffer b = new Buffer("0123456789ABCDEFGHIJKLMN"); - b.delete(2, 7); - assertEquals(b.toString(), "01789ABCDEFGHIJKLMN"); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java deleted file mode 100644 index 4f463d1..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java +++ /dev/null @@ -1,89 +0,0 @@ -/* Constants_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser.low; - -import test.gnu.javax.swing.text.html.parser.TestCase; - -import gnu.javax.swing.text.html.parser.support.low.Buffer; -import gnu.javax.swing.text.html.parser.support.low.Constants; -import gnu.javax.swing.text.html.parser.support.low.Token; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class Constants_Test - extends TestCase -{ - Constants c = new Constants(); - - public void testCases() - { - verify("x stYle ", c.STYLE, "stYle"); - verify("x !style!", c.STYLE, "style"); - verify("x !Script!", c.SCRIPT, "Script"); - verify(" \r\t\n z", c.WS, " \r\t\n "); - verify("123 ", c.NUMTOKEN, "123"); - verify("AaB123#", c.NUMTOKEN, "AaB123"); - verify("x-- ", c.DOUBLE_DASH, "--"); - verify("x--- ", c.DOUBLE_DASH, "--"); - - verify("z&entitu ", c.ENTITY, "&entitu"); - - verifyNull("x stYle"); - verifyNull("x !style"); - verifyNull("x !Script"); - verifyNull(" \r\t\n "); - verifyNull("123"); - verifyNull("AaB123"); - verifyNull("x--"); - } - - public void verify(String sequence, int kind, String image) - { - Token t = c.endMatches(new Buffer(sequence)); - assertEquals(kind, t.kind); - assertEquals(image, t.getImage()); - } - - public void verifyNull(String sequence) - { - Token t = c.endMatches(new Buffer(sequence)); - assertNull("The end should not match any token", t); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java deleted file mode 100644 index ebfda42..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java +++ /dev/null @@ -1,159 +0,0 @@ -/* ReaderTokenizer_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser.low; - -import test.gnu.javax.swing.text.html.parser.TestCase; - -import gnu.javax.swing.text.html.parser.support.low.Constants; -import gnu.javax.swing.text.html.parser.support.low.ReaderTokenizer; -import gnu.javax.swing.text.html.parser.support.low.Token; -import gnu.javax.swing.text.html.parser.support.low.node; -import gnu.javax.swing.text.html.parser.support.low.pattern; - -import java.io.StringReader; - -import java.util.ArrayList; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class ReaderTokenizer_Test - extends TestCase -{ - ReaderTokenizer rt = new ReaderTokenizer(); - - public void testComplexToken() - throws Exception - { - String x = "< style >x"; - - pattern a = - new pattern(new node[] - { - new node(Constants.BEGIN), new node(Constants.NUMTOKEN), - new node(Constants.END), new node(Constants.NUMTOKEN) - } - ); - - pattern b = - new pattern(new node[] - { - new node(Constants.BEGIN), new node(Constants.STYLE), - new node(Constants.END), new node(Constants.NUMTOKEN) - } - ); - - pattern c = - new pattern(new node[] - { - new node(Constants.BEGIN), new node(Constants.WS, true), - new node(Constants.STYLE), new node(Constants.WS, true), - new node(Constants.END), new node(Constants.NUMTOKEN) - } - ); - - pattern d = - new pattern(new node[] - { - new node(Constants.BEGIN), new node(Constants.WS, true), - new node(Constants.STYLE), new node(Constants.WS, true), - new node(Constants.END), new node(Constants.BEGIN) - } - ); - - ReaderTokenizer rt = new ReaderTokenizer(); - rt.reset(new StringReader(x)); - - assertFalse(a.matches(rt)); - assertFalse(b.matches(rt)); - assertTrue(c.matches(rt)); - assertFalse(d.matches(rt)); - } - - public void testReadingAndAhead() - throws Exception - { - ArrayList tokens = new ArrayList(); - StringBuffer b = new StringBuffer(); - for (int i = 0; i < 10; i++) - { - String r = rs(); - b.append(" "); - b.append(r + i); - tokens.add(" "); - tokens.add(r + i); - } - rt.reset(new StringReader(b.toString())); - - for (int i = 0; i < 10; i++) - { - for (int ah = 0; ah < 10; ah++) - { - Token ahead = rt.getTokenAhead(ah); - if (i + ah >= tokens.size()) - { - assertEquals(ahead.kind, rt.EOF); - } - else - { - if ((i + ah) % 2 == 0) - assertEquals(ahead.kind, rt.WS); - else - { - assertEquals(ahead.getImage(), tokens.get(i + ah)); - assertEquals(ahead.kind, rt.NUMTOKEN); - } - } - } - - Token r = rt.getNextToken(); - assertEquals(r.getImage(), tokens.get(i)); - } - } - - private String rs() - { - StringBuffer b = new StringBuffer(); - for (int i = 0; i < 10 * Math.random(); i++) - { - b.append("l"); - } - return b.toString(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java deleted file mode 100644 index 866a7fc..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java +++ /dev/null @@ -1,92 +0,0 @@ -/* parameterDefaulter_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import gnu.javax.swing.text.html.parser.HTML_401F; -import gnu.javax.swing.text.html.parser.htmlAttributeSet; -import gnu.javax.swing.text.html.parser.support.parameterDefaulter; - -import javax.swing.text.AttributeSet; -import javax.swing.text.html.HTML; -import javax.swing.text.html.HTML.Attribute; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class parameterDefaulter_Test - extends TestCase -{ - parameterDefaulter defaulter; - - public void testDefaultValues() - { - AttributeSet d; - d = defaulter.getDefaultParameters("FrAmE"); - assertEquals(d.getAttribute("scrolling"), "auto"); - d = defaulter.getDefaultParameters("input"); - assertEquals(d.getAttribute("type"), "text"); - - htmlAttributeSet hma = new htmlAttributeSet(); - hma.setResolveParent(d); - hma.addAttribute("ku", "1"); - hma.addAttribute(Attribute.ACTION, "sleep"); - - assertEquals(hma.getAttribute("action"), "sleep"); - assertEquals(hma.getAttribute(Attribute.ACTION), "sleep"); - assertEquals(hma.getAttribute("ku"), "1"); - - // Calling the parent: - assertEquals(hma.getAttribute(Attribute.TYPE), "text"); - - d = defaulter.getDefaultParameters("audrius"); - assertEquals(d.getAttribute("scrolling"), null); - } - - protected void setUp() - { - defaulter = new parameterDefaulter(HTML_401F.getInstance()); - } - - protected void tearDown() - throws java.lang.Exception - { - defaulter = null; - super.tearDown(); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java deleted file mode 100644 index d17298f..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java +++ /dev/null @@ -1,86 +0,0 @@ -/* supplementaryNotifications.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import javax.swing.text.MutableAttributeSet; -import javax.swing.text.html.HTML; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class supplementaryNotifications - extends TestCase -{ - String eoln = null; - int flushed = 0; - - public void testHTMLParsing() - throws Exception - { - Parser_Test v = - new Parser_Test() - { - public void handleEndOfLineString(String end_of_line) - { - eoln = end_of_line; - } - - public void flush() - { - flushed++; - } - }; - - v.hideImplied = true; - - v.verify("a \n b", "<html><head></head><body>'a b'</body></html>"); - - assertEquals(eoln, "\n"); - - v.verify("a \r b", "<html><head></head><body>'a b'</body></html>"); - - assertEquals(eoln, "\r"); - - v.verify("a \r\n b", "<html><head></head><body>'a b'</body></html>"); - - assertEquals(eoln, "\r\n"); - - assertEquals(flushed, 3); - } -} diff --git a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java b/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java deleted file mode 100644 index 9149c54..0000000 --- a/libjava/classpath/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java +++ /dev/null @@ -1,150 +0,0 @@ -/* textPreProcessor_Test.java -- - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package test.gnu.javax.swing.text.html.parser; - -import gnu.javax.swing.text.html.parser.support.textPreProcessor; - -/** - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) - */ -public class textPreProcessor_Test - extends TestCase -{ - textPreProcessor p = new textPreProcessor(); - - public void testPreFormattedPreProcessing() - { - verifyF("rnrn...r.n.Q.Q.r.n.rn.Q...r.r.rn", "n...n.n.Q.Q.n.n.n.Q...n.n."); - verifyF("...r.n.Q.Q.r.n.rn.Q...r.r.n", "...n.n.Q.Q.n.n.n.Q...n.n."); - verifyF("r...r.n.Q.Q.r.n.rn.Q...r.r.n", "...n.n.Q.Q.n.n.n.Q...n.n."); - verifyF("Q", "Q"); - verifyF(".", "."); - verifyF("abc..\t..xyz", "abc..\t..xyz"); - verifyF("abcxyz", "abcxyz"); - } - - public void testStandardPreProcessing() - { - verifyS("...r.n.Q.Q.r.n.rn.Q...r.r.n", "Q.Q.Q"); - verifyS("r...r.n.Q.Q.r.n.rn.Q...r.r.n", "Q.Q.Q"); - verifyS("Q", "Q"); - verifyS(" ", null); - verifyS(" \r\n", null); - verifyS("abc..\t..xyz", "abc.xyz"); - verifyS("abcxyz", "abcxyz"); - } - - StringBuffer fromText(String x) - { - StringBuffer b = new StringBuffer(); - char c; - for (int i = 0; i < x.length(); i++) - { - c = x.charAt(i); - - if (c == 'n') - b.append('\n'); - else if (c == 'r') - b.append('\r'); - else if (c == '.') - b.append(' '); - else - b.append(c); - } - return b; - } - - StringBuffer toText(String x) - { - StringBuffer b = new StringBuffer(); - char c; - for (int i = 0; i < x.length(); i++) - { - c = x.charAt(i); - - if (c == '\n') - b.append('n'); - else if (c == '\r') - b.append('r'); - else if (c == ' ') - b.append('.'); - else - b.append(c); - } - return b; - } - - void verifyF(String text, String result) - { - char[] pp = p.preprocessPreformatted(fromText(text)); - - if (result == null && pp == null) - return; - - String processed = new String(pp); - - processed = toText(processed).toString(); - - if (!processed.equals(result)) - { - System.err.println(result); - System.out.println(processed); - } - assertEquals(text, result, processed); - } - - void verifyS(String text, String result) - { - char[] pp = p.preprocess(fromText(text)); - - if (result == null && pp == null) - return; - - String processed = new String(pp); - - processed = toText(processed).toString(); - - if (!processed.equals(result)) - { - System.err.println(result); - System.out.println(processed); - } - assertEquals(text, result, processed); - } -} diff --git a/libjava/classpath/testsuite/lib/java.exp b/libjava/classpath/testsuite/lib/java.exp deleted file mode 100644 index e122726..0000000 --- a/libjava/classpath/testsuite/lib/java.exp +++ /dev/null @@ -1,212 +0,0 @@ -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> -# -# Java regression tester for DejaGNU -# - -load_lib target.exp - -# -# Compile and run all available java source -# -proc test-java-source { } { - global srcdir - global subdir - global runtests - - # Find all Java-files - foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.java]] { - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] then { - continue - } - - java-compile-execute $src - } - - # Find all jasmin (java assambler) files - foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.j]] { - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] then { - continue - } - - jasmin-assemble-execute $src - } -} - -# -# Compile #args -# -proc java-compile { args } { - set src $args - set output "" - set options "" - set comp_output [javac-target-compile "$src" "$output" executable $options]; -} - -# -# Assemble #args -# -proc jasmin-assemble { args } { - set src $args - set output "" - set options "" - set comp_output [jasmin-target-assemble "$src" "$output" executable $options]; -} - -# -# Compile $args and execute java class runtime_test -# -proc java-compile-execute { args } { - global srcdir - global subdir - - set comp_output [java-compile $args] - if ![regexp "^$" $comp_output] { - # Do not care about kaffes stupid messages - #fail $args - #print "$comp_output" - #return - } - - global JAVA - set java $JAVA - - set classpath [getenv CLASSPATH] - setenv CLASSPATH "${srcdir}/$subdir:$classpath" - - # XXX There must be a better way to get basename - catch {exec basename $args .java} basename - catch {exec $java $basename} run_output - exec rm -f "${srcdir}/$subdir/$basename.class" - - set lines "" - foreach line [split $run_output \n] { - if [regexp "PASSED:.*" $line] { - if ![regexp "^$" $lines] { - fail "$args $lines" - } - pass "$args $line" - } else { - if [regexp "FAILED:.*" $line] { - fail "$args $line" - } else { - # Accumulate "wild" lines - if ![regexp "^$" $lines] { - set lines "$lines\n $line" - } else { - set lines "$line" - } - } - } - } - if ![regexp "^$" $lines] { - fail "$args $lines" - } - - # Reset CLASSPATH - setenv CLASSPATH "$classpath" - - return; -} - -# -# Compile $args and execute java class runtime_test -# -proc jasmin-assemble-execute { args } { - global srcdir - global subdir - - set comp_output [jasmin-assemble $args] - if ![regexp "^$" $comp_output] { - #fail $args - #print "$comp_output" - #return - } - - # XXX Should use some default value - global JAVA - set java $JAVA - - set classpath [getenv CLASSPATH] - setenv CLASSPATH "${srcdir}/$subdir:$classpath" - - # XXX There must be a better way to get basename - catch {exec basename $args .j} basename - catch {exec $java $basename} run_output - exec rm -f "${srcdir}/$subdir/$basename.class" - - set lines "" - foreach line [split $run_output \n] { - if [regexp "PASSED:.*" $line] { - if ![regexp "^$" $lines] { - fail "$args $lines" - } - pass "$args $line" - } else { - if [regexp "FAILED:.*" $line] { - fail "$args $line" - } else { - # Accumulate "wild" lines - if ![regexp "^$" $lines] { - set lines "$lines\n $line" - } else { - set lines "$line" - } - } - } - } - if ![regexp "^$" $lines] { - fail "$args $lines" - } - - # Reset CLASSPATH - setenv CLASSPATH "$classpath" - - return; -} - -# -# Compile java source -# -proc javac-target-compile { source dest type options } { -# XXX Do it the simple way - should use target_compile - - global JAVAC - set javac $JAVAC - - catch {exec $javac $source} comp_output - return $comp_output - -# set options "" -# lappend options "compiler=javac" -# lappend options "additional_flags=-g" -# lappend options "libs=" -# lappend options "ldflags=" -# return [target_compile $source $dest $type $options] -} - -# -# Compile jasmin (java assambly) source -# -proc jasmin-target-assemble { source dest type options } { - global srcdir - global subdir -# XXX Do it the simple way - should use target_compile - - global JAVA - set java $JAVA - - catch {exec $java jasmin.Main -d $srcdir/$subdir $source} comp_output - - return comp_output; -# set options "" -# lappend options "compiler=javac" -# lappend options "additional_flags=-g" -# lappend options "libs=" -# lappend options "ldflags=" -# return [target_compile $source $dest $type $options] -} diff --git a/libjava/classpath/testsuite/scheme/test.scm b/libjava/classpath/testsuite/scheme/test.scm deleted file mode 100644 index 74b4b21..0000000 --- a/libjava/classpath/testsuite/scheme/test.scm +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/local/bin/guile -s -!# - -; Guile/JNI/JVM Testing Framework -; -; Copyright (c) 1998 Free Software Foundation, Inc. -; Written by Paul Fisher (rao@gnu.org) -; -; This program 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 of the License, or -; (at your option) any later version. -; -; This program 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 this program; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -; USA. - - -; log filenames -(define verbose-log-file "classpath.log") -(define summary-log-file "classpath.sum") - -; returns the number of times that ELEM appears in the toplevel of LS -(define count - (lambda (elem ls) - (letrec - ((count-it - (lambda (ls acc) - (cond - ((null? ls) acc) - ((equal? (car ls) elem) (count-it (cdr ls) (+ acc 1))) - (else (count-it (cdr ls) acc)))))) - (count-it ls 0)))) - -; returns a list of pairs containing an element of ELS along with the -; number of times that element appears in LS -(define build-result-count - (lambda (els ls) - (cond - ((null? els) '()) - (else (cons (cons (car els) (count (car els) ls)) - (build-result-count (cdr els) ls)))))) - -; soft port which sends output to both (current-output-port) and -; the verbose-log-port -(define screen-and-log-port - (make-soft-port - (vector - (lambda (c) - (cond - ((char=? c #\newline) - (newline (current-output-port)) - (newline verbose-log-port)) - (else - (write c (current-output-port)) - (write c verbose-log-port)))) - (lambda (s) - (display s (current-output-port)) - (display s verbose-log-port)) - (lambda () - (force-output (current-output-port)) - (force-output verbose-log-port)) - #f - #f) - "w")) - -; pretty prints the result of a single test -(define display-test-summary - (lambda (result port) - (let ((name (car result)) - (code (cadr result)) - (msg (caddr result))) - (display "Name : " port) - (display name port) - (newline port) - (display "Result : " port) - (display code port) - (newline port) - (display "Message : " port) - (if (= (string-length msg) 0) - (display "None" port) - (display msg port)) - (newline port) - (newline port)))) - -; status message -(define display-running - (lambda (class port) - (display "Running " port) - (display class port) - (display "..." port) - (newline port))) - -; runs the test named CLASS -(define run-test - (lambda (class) - (display-running class screen-and-log-port) - (force-output verbose-log-port) - (let ((result (test class))) - (display-test-summary result screen-and-log-port) - (write (cons class result) summary-log-port) - (newline summary-log-port) - (cadr result)))) - -; run each and every test. each test is read from PORT -; and delimited by a newline. returns a list of all test result codes -(define parse-input-file - (lambda (port) - (letrec - ((parse-line - (lambda (line) - (cond - ((eof-object? (car line)) '()) - ((= (string-length (car line)) 0) - (parse-line (read-line port 'split))) - (else (cons (run-test (car line)) - (parse-line - (read-line port 'split)))))))) - (parse-line (read-line port 'split))))) - -; pretty prints the result list -(define display-results - (lambda (results port) - (display "Summary information..." port) - (newline port) - (letrec ((display-results-l - (lambda (ls) - (cond - ((null? ls)) - (else - (let ((res (car ls))) - (display "# of " port) - (display (car res) port) - (display "'s " port) - (display (cdr res) port) - (newline port)) - (display-results-l (cdr ls))))))) - (display-results-l results)))) - -(if (batch-mode?) - (if (> (length (command-line)) 1) - (define input-port (open-input-file (cadr (command-line)))) - (error "filename listing tests to execute must be specified."))) - -; open up the log files -(define verbose-log-port (open verbose-log-file - (logior O_WRONLY O_CREAT O_TRUNC))) -(define summary-log-port (open summary-log-file - (logior O_WRONLY O_CREAT O_TRUNC))) - -; redirect stderr to the verbose log -(dup verbose-log-port 2) - -; run the tests, and build the result table, and display the results -(display-results (build-result-count - '(PASS XPASS FAIL XPAIL UNRESOLVED - UNSUPPORTED UNTESTED ERROR) - (parse-input-file input-port)) screen-and-log-port) |