1.1 --- a/tests/ValueSubclass.java Sun Jan 23 01:01:34 2005 +0100
1.2 +++ b/tests/ValueSubclass.java Sun Jan 23 01:01:40 2005 +0100
1.3 @@ -29,9 +29,50 @@
1.4 public void setValueObject(Value v) {
1.5 this.value = v.getValue();
1.6 }
1.7 +
1.8 + /**
1.9 + * Test program.
1.10 + */
1.11 + public static void main(String[] args) {
1.12 + SubclassValue sv = new SubclassValue(686);
1.13 + if (sv.getValue() == 686) {
1.14 + System.out.println("sv.getValue() correct: " + sv.getValue());
1.15 + } else {
1.16 + System.err.println("sv.getValue() failed!");
1.17 + }
1.18 +
1.19 + ValueSubclass vs = new ValueSubclass(109);
1.20 + if (vs.tmp.getValue() == 42) {
1.21 + System.out.println("vs.tmp.getValue() correct: " + vs.tmp.getValue());
1.22 + } else {
1.23 + System.err.println("vs.tmp.getValue() failed!");
1.24 + }
1.25 + if (vs.getValue() == 109) {
1.26 + System.out.println("vs.getValue() correct: " + vs.getValue());
1.27 + } else {
1.28 + System.err.println("vs.getValue() failed!");
1.29 + }
1.30 + vs.setValue(404);
1.31 + if (vs.getValue() == -404) {
1.32 + System.out.println("vs.getValue() correct: " + vs.getValue());
1.33 + } else {
1.34 + System.err.println("vs.getValue() failed!");
1.35 + }
1.36 + if (vs.add(404) == -808) {
1.37 + System.out.println("vs.add(404) correct: " + vs.add(404));
1.38 + } else {
1.39 + System.err.println("vs.add(404) failed!");
1.40 + }
1.41 + vs.setValueObject(sv);
1.42 + if (vs.getValue() == 686) {
1.43 + System.out.println("vs.getValue() correct: " + vs.getValue());
1.44 + } else {
1.45 + System.err.println("vs.getValue() failed!");
1.46 + }
1.47 + }
1.48 }
1.49
1.50 -// This should confuse the importer since it should be read before Value in
1.51 +// This would confuse a simple importer since it should be read before Value in
1.52 // alphabetical order.
1.53
1.54 class SubclassValue extends Value {
1.55 @@ -39,3 +80,5 @@
1.56 super(x);
1.57 }
1.58 }
1.59 +
1.60 +// vim: tabstop=4 expandtab shiftwidth=4