# HG changeset patch # User Paul Boddie # Date 1106433305 -3600 # Node ID 0a9d421f9b347baf73e580524cf7119e94455d21 # Parent feba07e568f93d8dacb8dd514cdce52478ebbec8 Added more test programs. diff -r feba07e568f9 -r 0a9d421f9b34 tests/ConcreteClassTest.java --- a/tests/ConcreteClassTest.java Sat Jan 22 23:35:05 2005 +0100 +++ b/tests/ConcreteClassTest.java Sat Jan 22 23:35:05 2005 +0100 @@ -1,2 +1,12 @@ public class ConcreteClassTest extends AbstractClassTest { + public static void main(String[] args) { + ConcreteClassTest test = new ConcreteClassTest(); + if (test.member != null && test.member instanceof ConcreteClassTest) { + System.out.println("test.member correct: " + test.member); + } else { + System.err.println("test.member failed!"); + } + } } + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r feba07e568f9 -r 0a9d421f9b34 tests/FieldSubclassTest.java --- a/tests/FieldSubclassTest.java Sat Jan 22 23:35:05 2005 +0100 +++ b/tests/FieldSubclassTest.java Sat Jan 22 23:35:05 2005 +0100 @@ -1,2 +1,27 @@ public class FieldSubclassTest extends FieldTest { + public static void main(String[] args) { + if (FieldSubclassTest.h != null && FieldSubclassTest.h.a == 789) { + System.out.println("FieldSubclassTest.h.a correct: " + FieldSubclassTest.h.a); + } else { + System.out.println("FieldSubclassTest.h.a failed!"); + } + FieldSubclassTest test = new FieldSubclassTest(); + if (test.h != null && test.h.a == 789) { + System.out.println("test.h.a correct: " + test.h.a); + } else { + System.out.println("test.h.a failed!"); + } + if (test.e != null && test.e.a == 456) { + System.out.println("test.e.a correct: " + test.e.a); + } else { + System.out.println("test.e.a failed!"); + } + if (test.f != null && test.f.a == 579) { + System.out.println("test.f.a correct: " + test.f.a); + } else { + System.out.println("test.f.a failed!"); + } + } } + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r feba07e568f9 -r 0a9d421f9b34 tests/FieldTest.java --- a/tests/FieldTest.java Sat Jan 22 23:35:05 2005 +0100 +++ b/tests/FieldTest.java Sat Jan 22 23:35:05 2005 +0100 @@ -7,6 +7,30 @@ public FieldTestClass f = new FieldTestClass(b + e.a); public static FieldTestClass g; public static FieldTestClass h = new FieldTestClass(789); + + public static void main(String[] args) { + if (FieldTest.h != null && FieldTest.h.a == 789) { + System.out.println("FieldTest.h.a correct: " + FieldTest.h.a); + } else { + System.out.println("FieldTest.h.a failed!"); + } + FieldTest test = new FieldTest(); + if (test.h != null && test.h.a == 789) { + System.out.println("test.h.a correct: " + test.h.a); + } else { + System.out.println("test.h.a failed!"); + } + if (test.e != null && test.e.a == 456) { + System.out.println("test.e.a correct: " + test.e.a); + } else { + System.out.println("test.e.a failed!"); + } + if (test.f != null && test.f.a == 579) { + System.out.println("test.f.a correct: " + test.f.a); + } else { + System.out.println("test.f.a failed!"); + } + } } class FieldTestClass { @@ -16,3 +40,5 @@ this.a = a; } } + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r feba07e568f9 -r 0a9d421f9b34 tests/MainTest.java --- a/tests/MainTest.java Sat Jan 22 23:35:05 2005 +0100 +++ b/tests/MainTest.java Sat Jan 22 23:35:05 2005 +0100 @@ -5,3 +5,5 @@ } } } + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r feba07e568f9 -r 0a9d421f9b34 tests/MultiArrayTest.java --- a/tests/MultiArrayTest.java Sat Jan 22 23:35:05 2005 +0100 +++ b/tests/MultiArrayTest.java Sat Jan 22 23:35:05 2005 +0100 @@ -8,4 +8,32 @@ public int get(int index1, int index2) { return multiArray[index1][index2]; } + + public static void main(String[] args) { + int[] sizes = {4, 7}; + MultiArrayTest test = new MultiArrayTest(sizes); + if (test.multiArray.length != 4) { + System.err.println("test.multiArray.length failed!"); + } else { + System.out.println("test.multiArray.length correct: " + test.multiArray.length); + } + if (test.multiArray[0].length != 7) { + System.err.println("test.multiArray[0].length failed!"); + } else { + System.out.println("test.multiArray[0].length correct: " + test.multiArray[0].length); + } + if (test.multiArray[3][6] != 0) { + System.err.println("test.multiArray[3][6] failed!"); + } else { + System.out.println("test.multiArray[3][6] correct: " + test.multiArray[3][6]); + } + test.multiArray[3][6] = 36; + if (test.get(3, 6) != 36) { + System.err.println("test.get(3, 6) failed!"); + } else { + System.out.println("test.get(3, 6) correct: " + test.get(3, 6)); + } + } } + +// vim: tabstop=4 expandtab shiftwidth=4