# HG changeset patch # User Paul Boddie # Date 1106066844 -3600 # Node ID 3e197ad55b82e1e97fdecadfc22c9108e037b8be # Parent 14c7f90abf1b0b1d79cc59db5be25585ba8f6d52 Added more test programs. diff -r 14c7f90abf1b -r 3e197ad55b82 tests/ArrayTest.java --- a/tests/ArrayTest.java Tue Jan 18 17:17:29 2005 +0100 +++ b/tests/ArrayTest.java Tue Jan 18 17:47:24 2005 +0100 @@ -8,4 +8,25 @@ public int get(int index) { return array[index]; } + + public static void main(String[] args) { + ArrayTest test = new ArrayTest(10); + if (test.array.length != 10) { + System.err.println("test.array.length failed!"); + } else { + System.out.println("test.array.length correct: " + test.array.length); + } + for (int i = 0; i < test.array.length; i++) { + test.array[i] = i + 10; + } + for (int j = 0; j < test.array.length; j++) { + if (test.get(j) != j + 10) { + System.err.println("test.get(" + j + ") failed!"); + } else { + System.out.println("test.get(" + j + ") correct: " + test.get(j)); + } + } + } } + +// vim: tabstop=4 expandtab shiftwidth=4 diff -r 14c7f90abf1b -r 3e197ad55b82 tests/ComparisonTest.java --- a/tests/ComparisonTest.java Tue Jan 18 17:17:29 2005 +0100 +++ b/tests/ComparisonTest.java Tue Jan 18 17:47:24 2005 +0100 @@ -23,4 +23,40 @@ return false; } } + + public static void main(String[] args) { + ComparisonTest test = new ComparisonTest(); + if (test.equals(1, -1)) { + System.err.println("test.equals(1, -1) failed!"); + } else { + System.out.println("test.equals(1, -1) correct: " + test.equals(1, -1)); + } + if (!test.equals(10, 10)) { + System.err.println("test.equals(10, 10) failed!"); + } else { + System.out.println("test.equals(10, 10) correct: " + test.equals(10, 10)); + } + if (test.lessThan(1, -1)) { + System.err.println("test.lessThan(1, -1) failed!"); + } else { + System.out.println("test.lessThan(1, -1) correct: " + test.lessThan(1, -1)); + } + if (!test.lessThan(1, 15)) { + System.err.println("test.lessThan(1, 15) failed!"); + } else { + System.out.println("test.lessThan(1, 15) correct: " + test.lessThan(1, 15)); + } + if (test.greaterThan(23, 29)) { + System.err.println("test.greaterThan(23, 29) failed!"); + } else { + System.out.println("test.greaterThan(23, 29) correct: " + test.greaterThan(23, 29)); + } + if (!test.greaterThan(-23, -29)) { + System.err.println("test.greaterThan(-23, -29) failed!"); + } else { + System.out.println("test.greaterThan(-23, -29) correct: " + test.greaterThan(-23, -29)); + } + } } + +// vim: tabstop=4 expandtab shiftwidth=4