1 diff -u check1/FloatingPointCheck.java check/FloatingPointCheck.java
2 --- check1/FloatingPointCheck.java Wed Jun 17 22:14:10 1998
3 +++ check/FloatingPointCheck.java Fri Oct 25 16:11:23 2002
5 * End of sample execution
8 -package spec.benchmarks._200_check;
9 -import spec.harness.Context;
11 public class FloatingPointCheck {
13 // Level of print output produced
18 - Context.out.println("Ooops: double range too big near 0");
19 + System.out.println("Ooops: double range too big near 0");
23 if (print && verbose) {
25 - Context.out.println(" tiny: " +
26 + System.out.println(" tiny: " +
28 - Context.out.println(" tiny/small: " +
29 + System.out.println(" tiny/small: " +
30 (doubleTiny/doubleSmall));
31 - Context.out.println(" (tiny/small)*big: " +
32 + System.out.println(" (tiny/small)*big: " +
33 ((doubleTiny/doubleSmall)*doubleBig));
34 - Context.out.println(" MIN_VALUE*big: " +
35 + System.out.println(" MIN_VALUE*big: " +
36 (Double.MIN_VALUE*doubleBig));
37 - Context.out.println(" (tiny*big)/small: " +
38 + System.out.println(" (tiny*big)/small: " +
39 ((doubleTiny*doubleBig)/doubleSmall));
43 if ( check != Double.POSITIVE_INFINITY ) {
46 - Context.out.println("Ooops: double range too big near infinity");
47 + System.out.println("Ooops: double range too big near infinity");
50 if (print && verbose) {
52 - Context.out.println(" huge: " +
53 + System.out.println(" huge: " +
55 - Context.out.println(" huge*small: " +
56 + System.out.println(" huge*small: " +
57 (doubleHuge*doubleSmall));
58 - Context.out.println(" (huge*small)/big: " +
59 + System.out.println(" (huge*small)/big: " +
60 ((doubleHuge*doubleSmall)/doubleBig));
67 - Context.out.println("Ooops: float range too big near 0");
68 + System.out.println("Ooops: float range too big near 0");
72 if (print && verbose) {
74 - Context.out.println(" tiny: " +
75 + System.out.println(" tiny: " +
77 - Context.out.println(" tiny/small: " +
78 + System.out.println(" tiny/small: " +
79 (floatTiny/floatSmall));
80 - Context.out.println(" (tiny/small)*big: " +
81 + System.out.println(" (tiny/small)*big: " +
82 ((floatTiny/floatSmall)*floatBig));
83 - Context.out.println(" MIN_VALUE*big: " +
84 + System.out.println(" MIN_VALUE*big: " +
85 (Float.MIN_VALUE*floatBig));
86 - Context.out.println(" (tiny*big)/small: " +
87 + System.out.println(" (tiny*big)/small: " +
88 ((floatTiny*floatBig)/floatSmall));
92 if ( check != Float.POSITIVE_INFINITY ) {
95 - Context.out.println("Ooops: float range too big near infinity");
96 + System.out.println("Ooops: float range too big near infinity");
99 if (print && verbose) {
101 - Context.out.println(" huge: " +
102 + System.out.println(" huge: " +
104 - Context.out.println(" huge*small: " +
105 + System.out.println(" huge*small: " +
106 (floatHuge*floatSmall));
107 - Context.out.println(" (huge*small)/big: " +
108 + System.out.println(" (huge*small)/big: " +
109 ((floatHuge*floatSmall)/floatBig));
112 @@ -195,18 +192,18 @@
116 - Context.out.println("Ooops: double precision too big near 1");
117 + System.out.println("Ooops: double precision too big near 1");
120 if (print && verbose) {
122 - Context.out.println(" eps: " +
123 + System.out.println(" eps: " +
125 - Context.out.println(" eps: 0x" +
126 + System.out.println(" eps: 0x" +
127 Long.toString(Double.doubleToLongBits(doubleEpsilon), 16));
128 - Context.out.println(" 1+eps: " +
129 + System.out.println(" 1+eps: " +
130 (doubleOne+doubleEpsilon) );
131 - Context.out.println(" (1+eps)-1: " +
132 + System.out.println(" (1+eps)-1: " +
133 ((doubleOne+doubleEpsilon)-doubleOne) );
136 @@ -223,18 +220,18 @@
140 - Context.out.println("Ooops: float precision too big near 1");
141 + System.out.println("Ooops: float precision too big near 1");
144 if (print && verbose) {
146 - Context.out.println(" eps: " +
147 + System.out.println(" eps: " +
149 - Context.out.println(" eps: 0x" +
150 + System.out.println(" eps: 0x" +
151 Integer.toString(Float.floatToIntBits(floatEpsilon), 16));
152 - Context.out.println(" 1+eps: " +
153 + System.out.println(" 1+eps: " +
154 (floatOne+floatEpsilon) );
155 - Context.out.println(" (1+eps)-1: " +
156 + System.out.println(" (1+eps)-1: " +
157 ((floatOne+floatEpsilon)-floatOne) );
161 // compiler with a floating point bug might pass at say 1% where
162 // it hadn't fully compiled everything, but then fail at 100%
163 // after it compiled erroneously
164 - Context.out.println("FloatingPointCheck");
165 + System.out.println("FloatingPointCheck");
167 for (count = 0; count < 1*10000*length; count += 1) {
170 // Run it once to get the answers
173 - Context.out.println ("Error");
174 + System.out.println ("Error");
176 - Context.out.println ("OK");
177 + System.out.println ("OK");
180 public static void main(String[] args) {
181 diff -u check1/LoopBounds.java check/LoopBounds.java
182 --- check1/LoopBounds.java Wed Jun 17 22:14:11 1998
183 +++ check/LoopBounds.java Fri Oct 25 22:31:48 2002
188 -package spec.benchmarks._200_check;
189 -import spec.harness.*;
190 import java.util.Vector;
191 -import spec.benchmarks._200_check.*;
196 public void execute(){
197 for (int i= 0; i < size(); ++i) {
198 //System.out.println ("v.size()=" + v.size() + " size()=" + size());
199 - Context.out.print (constraintAt(i) + " ");
200 + System.out.print (constraintAt(i) + " ");
202 - Context.out.println();
203 + System.out.println();
206 public static void main (String[] args){
209 public static void run (){
210 (new LoopBounds()).execute();
211 - String name = "spec.benchmarks._200_check.LoopBounds2";
213 + String name = "LoopBounds2";
215 Class c = Class.forName (name);
216 Object o = c.newInstance();
217 if (! (o instanceof LoopBounds)){
218 - Context.out.println (name + " is not a LoopBounds\n");
219 + System.out.println (name + " is not a LoopBounds\n");
223 ((LoopBounds) o).execute();
224 }catch (Exception e){
225 - Context.out.println ("Error " + e);
226 + System.out.println ("Error " + e);
233 diff -u check1/Main.java check/Main.java
234 --- check1/Main.java Wed Jun 17 22:14:12 1998
235 +++ check/Main.java Fri Oct 25 16:17:32 2002
237 * fail output verification.
240 -package spec.benchmarks._200_check;
241 -import spec.harness.*;
243 -public class Main implements SpecBenchmark {
246 ///////////////////////////////////////
247 //class variable field declarations
249 int[] a = new int[10];
250 for (int i=0; i<=10; i++)
252 - spec.harness.Context.out.println("Error: array bounds not checked");
253 + System.out.println("Error: array bounds not checked");
254 }catch (ArrayIndexOutOfBoundsException e){
260 - spec.harness.Context.out.println("1st bounds test error:\tindex exception not received");
261 + System.out.println("1st bounds test error:\tindex exception not received");
263 - spec.harness.Context.out.println("1st bounds test error:\tfinally clause not executed");
264 + System.out.println("1st bounds test error:\tfinally clause not executed");
265 if (caughtIndex && gotToFinally)
266 - spec.harness.Context.out.println("1st bounds test:\tOK");
267 + System.out.println("1st bounds test:\tOK");
269 LoopBounds mule = new LoopBounds();
272 - spec.harness.Context.out.println("2nd bounds test:\tfailed");
273 + System.out.println("2nd bounds test:\tfailed");
275 - spec.harness.Context.out.println("2nd bounds test:\tOK");
276 + System.out.println("2nd bounds test:\tOK");
277 PepTest horse = new PepTest();
278 horse.instanceMain();
280 - spec.harness.Context.out.println("PepTest failed");
281 + System.out.println("PepTest failed");
285 public static void main( String[] args ) {
286 runBenchmark( args );
287 + new FloatingPointCheck().run(100);
290 private static void checkSubclassing(){
291 Super sup = new Super (3);
292 Sub sub = new Sub (3);
293 - spec.harness.Context.out.println (sup.getName() + ": " + sup.toString());
294 - spec.harness.Context.out.println (sub.getName() + ": " + sub.toString());
295 - spec.harness.Context.out.println ("Super: prot=" + sup.getProtected() +
296 + System.out.println (sup.getName() + ": " + sup.toString());
297 + System.out.println (sub.getName() + ": " + sub.toString());
298 + System.out.println ("Super: prot=" + sup.getProtected() +
299 ", priv=" + sup.getPrivate());
300 - spec.harness.Context.out.println ("Sub: prot=" + sub.getProtected() +
301 + System.out.println ("Sub: prot=" + sub.getProtected() +
302 ", priv=" + sub.getPrivate());
305 diff -u check1/PepTest.java check/PepTest.java
306 --- check1/PepTest.java Wed Jun 17 22:14:13 1998
307 +++ check/PepTest.java Fri Oct 25 16:12:43 2002
309 * This source code is provided as is, without any express or implied warranty.
312 -package spec.benchmarks._200_check;
313 -import spec.harness.*;
319 public boolean gotError = false;
322 - Context.out.print("testDiv: ");
323 + System.out.print("testDiv: ");
331 - Context.out.print("testIf: ");
332 + System.out.print("testIf: ");
338 String testBitOps() {
339 /* Simple test of a few bit operations. By no means complete. */
340 - Context.out.print("testBitOps: ");
341 + System.out.print("testBitOps: ");
343 if (shiftAnd(v, 24) != 0xca) return "bad shift-and 1";
344 if (shiftAnd(v, 16) != 0xfe) return "bad shift-and 2";
349 - Context.out.print("testFor: ");
350 + System.out.print("testFor: ");
351 for (int a = 0; a < 100; a++)
352 for (int b = a; b >=0; b = b - 2)
357 String testTableSwitch() {
358 - Context.out.print("testTableSwitch: ");
359 + System.out.print("testTableSwitch: ");
366 String testLookupSwitch() {
367 - Context.out.print("testLookupSwitch: ");
368 + System.out.print("testLookupSwitch: ");
375 String testHiddenField() {
376 - Context.out.print("testHiddenField: ");
377 + System.out.print("testHiddenField: ");
378 subClass f2 = new subClass();
381 @@ -318,10 +315,10 @@
384 java.util.Date now = new java.util.Date();
385 - Context.out.print("Time now is ");
386 - Context.out.print(now.toString());
387 - Context.out.print(", ms: ");
388 - Context.out.println(System.currentTimeMillis());
389 + System.out.print("Time now is ");
390 + System.out.print(now.toString());
391 + System.out.print(", ms: ");
392 + System.out.println(System.currentTimeMillis());
395 String checkInst(superClass x, boolean r1, boolean r2, boolean r3, int c) {
399 String checkInstanceOf() {
400 - Context.out.print("checkInstanceOf: ");
401 + System.out.print("checkInstanceOf: ");
403 /* subClass a[] = new subClass[2];
404 ((superClass[])a)[1] = new superClass(); */
408 String checkInterfaceInstanceOf() {
409 - Context.out.print("checkInterfaceInstanceOf: ");
410 + System.out.print("checkInterfaceInstanceOf: ");
411 java.lang.Object c1 = new C1();
412 java.lang.Object c2 = new C2();
413 java.lang.Object c3 = new C3();
418 - Context.out.print("testExc1(simple throw/catch): ");
419 + System.out.print("testExc1(simple throw/catch): ");
422 if (x == 0) x = 1; else x = -1;
427 - Context.out.print("testExc2(skip catch clauses): ");
428 + System.out.print("testExc2(skip catch clauses): ");
431 if (x == 0) x = 1; else x = -1;
436 - Context.out.print("testExc3(catch in inner): ");
437 + System.out.print("testExc3(catch in inner): ");
440 if (x == 0) x = 1; else x = -1;
445 - Context.out.print("testExc4(catch in outer): ");
446 + System.out.print("testExc4(catch in outer): ");
449 if (x == 0) x = 1; else x = -1;
454 - Context.out.print("testExc5(rethrow): ");
455 + System.out.print("testExc5(rethrow): ");
458 if (x == 0) x = 1; else x = -1;
463 - Context.out.print("testExc6(throw accross call): ");
464 + System.out.print("testExc6(throw accross call): ");
472 - Context.out.print("testExc7(throw accr. 2 calls): ");
473 + System.out.print("testExc7(throw accr. 2 calls): ");
478 final static int allocChunk = 50000;
481 - Context.out.print("testExc8(keep throwing; see if GC works): ");
482 + System.out.print("testExc8(keep throwing; see if GC works): ");
484 Runtime runt = Runtime.getRuntime();
485 long freeSpace = runt.freeMemory();
490 - Context.out.print("testExc9(keep throwing accross fct; see if GC works): ");
491 + System.out.print("testExc9(keep throwing accross fct; see if GC works): ");
493 Runtime runt = Runtime.getRuntime();
494 long freeSpace = runt.freeMemory();
498 String testStringHash() {
499 - Context.out.print("testStringHash: ");
500 + System.out.print("testStringHash: ");
502 /* These are the JDK1.1 values. */
503 if (null != (res = stringHash("monkey", -817689237, -1068495917)))
507 String testObjectHash() {
508 - Context.out.print("testObjectHash: ");
509 + System.out.print("testObjectHash: ");
510 java.util.Hashtable ht = new java.util.Hashtable();
512 for (int i = 0; i < 1000; i++) {
516 String loopExitContinueInExceptionHandler() {
517 - Context.out.print("loopExitContinueInExceptionHandler: ");
518 + System.out.print("loopExitContinueInExceptionHandler: ");
526 - Context.out.print("testClone: ");
527 + System.out.print("testClone: ");
528 int[] w, v = new int[100]; /* Check that we can clone arrays. */
529 for (int i = 0; i < v.length; i++) v[i] = i * i;
530 w = (int[])v.clone();
531 @@ -705,16 +702,16 @@
534 void printInterfaces(java.lang.Class cl) {
535 - Context.out.print(cl.getName() + ": ");
536 + System.out.print(cl.getName() + ": ");
537 java.lang.Class intf[] = cl.getInterfaces();
538 for (int i = 0; i < intf.length; i++) {
539 - Context.out.print(intf[i].getName() + " ");
540 + System.out.print(intf[i].getName() + " ");
541 if (!intf[i].isInterface())
542 - Context.out.println("Error: should have been an interface!");
543 + System.out.println("Error: should have been an interface!");
545 if (0 == intf.length)
546 - Context.out.print("no interfaces");
547 - Context.out.println();
548 + System.out.print("no interfaces");
549 + System.out.println();
556 String testWaitNull() {
557 - Context.out.print("testWaitNull: ");
558 + System.out.print("testWaitNull: ");
560 ((java.lang.Object)null).wait(43);
561 } catch (java.lang.Exception e) {
565 String testVarAndMethodNameClash() {
566 - Context.out.print("testVarAndMethodNameClash: ");
567 + System.out.print("testVarAndMethodNameClash: ");
568 superClass s = new superClass();
571 @@ -801,12 +798,12 @@
573 void checkAllNull(java.lang.Object a[]) {
574 for (int i = 0; i < a.length; i++) {
575 - if (a[i] != null) Context.out.println("error: should have been null");
576 + if (a[i] != null) System.out.println("error: should have been null");
580 String testObjectArray() {
581 - Context.out.print("testObjectArray: ");
582 + System.out.print("testObjectArray: ");
583 subClass a[] = new subClass[10];
584 superClass b[] = new superClass[10];
588 throw(new java.lang.ArithmeticException("fisk"));
590 - Context.out.println("should not print this");
591 + System.out.println("should not print this");
593 - Context.out.println("should print this");
594 + System.out.println("should print this");
599 static int staticIntArray[][] = {{1,2,3}, {4,5,6}};
602 - Context.out.print("testArray: ");
603 + System.out.print("testArray: ");
607 @@ -977,33 +974,33 @@
611 - Context.out.print("Primes less than 50: ");
612 + System.out.print("Primes less than 50: ");
613 for (int i = 2; i < 50; i++) {
615 - Context.out.print(i);
616 - Context.out.print(" ");
617 + System.out.print(i);
618 + System.out.print(" ");
621 - Context.out.println("");
622 + System.out.println("");
625 public void Verify(String str) {
626 if (null == str || str.equals(""))
627 - Context.out.println("OK");
628 + System.out.println("OK");
631 - Context.out.println();
632 - Context.out.println("******************************************");
633 - Context.out.println(str);
634 - Context.out.println("******************************************");
635 + System.out.println();
636 + System.out.println("******************************************");
637 + System.out.println(str);
638 + System.out.println("******************************************");
642 boolean checkRemL(long a, long b, long res) {
643 boolean ok = (res == a % b);
645 - Context.out.print("Failed: " + a + " % " + b + " = " + (a % b));
646 - Context.out.println(" (should be: " + res);
647 + System.out.print("Failed: " + a + " % " + b + " = " + (a % b));
648 + System.out.println(" (should be: " + res);
652 @@ -1011,21 +1008,21 @@
653 boolean checkRemD(double a, double b, double res) {
654 boolean ok = (res == a % b);
656 - Context.out.print("Failed: " + a + " % " + b + " = " + (a % b));
657 - Context.out.println(" (should be: " + res);
658 + System.out.print("Failed: " + a + " % " + b + " = " + (a % b));
659 + System.out.println(" (should be: " + res);
665 void printRemD(double a, double b) {
666 - Context.out.print(a + " % " + b + " = " + (a % b));
667 + System.out.print(a + " % " + b + " = " + (a % b));
670 String checkRemainders() {
671 - Context.out.print("checkRemainders: ");
672 + System.out.print("checkRemainders: ");
674 - Context.out.print(" long ");
675 + System.out.print(" long ");
676 if (!checkRemL( 10L, 7L, 3L)) ok = false;
677 if (!checkRemL( 10L, -7L, 3L)) ok = false;
678 if (!checkRemL(-10L, 7L, -3L)) ok = false;
679 @@ -1036,7 +1033,7 @@
680 if (!checkRemD(-10.5, 7.0, -3.5)) ok = false;
681 if (!checkRemD(-10.5, -7.0, -3.5)) ok = false;
682 if (!ok) return "remainders failed";
683 - Context.out.print("double ");
684 + System.out.print("double ");
688 @@ -1050,14 +1047,14 @@
690 if (m == 0.0) m = 1.0;
691 if ((v - r) / m > 0.0001) {
692 - Context.out.println(exprStr + " evaluated to: " + v + ", expected: " + r);
693 + System.out.println(exprStr + " evaluated to: " + v + ", expected: " + r);
699 String checkMathFcts() {
700 - Context.out.print("checkMathFcts: ");
701 + System.out.print("checkMathFcts: ");
703 if (!checkClose("log(0.7)", Math.log(0.7), -0.356675)) ok = false;
704 if (!checkClose("sin(0.7)", Math.sin(0.7), 0.644218)) ok = false;
705 @@ -1096,13 +1093,13 @@
708 String testDeepStack() {
709 - Context.out.print("testDeepStack: ");
710 + System.out.print("testDeepStack: ");
711 if (deepRecursion(5555, 0) != (5555 * 5555 + 5555) / 2) return "failed";
716 - Context.out.print("testMisk: ");
717 + System.out.print("testMisk: ");
718 String right = "-9223372036854775808";
719 if (!right.equals("" + ((long)1 << 63)))
720 return "(long)1 << 63 failed, returned: " + ((long)1 << 63) +
721 @@ -1134,7 +1131,7 @@
725 - Context.out.print("testGC: ");
726 + System.out.print("testGC: ");
727 byte[][] bytesArrays = new byte[1000][];
728 bytesArrays[0] = new byte[1000]; /* See if GC eats this array! */
729 Runtime.getRuntime().gc();
730 @@ -1156,7 +1153,7 @@
732 * Skip file tests in an applet, wnb 2/13/98
733 String testFileOps() {
734 - Context.out.print("testFileOps: ");
735 + System.out.print("testFileOps: ");
736 java.io.File f = new java.io.File(".");
737 if (!f.isDirectory()) return "'.' is not a directory";
738 if (!f.exists()) return "'.' does not exist";
739 @@ -1208,11 +1205,11 @@
740 // Don't perform fp accuracy check so that 80-bit intermediate values
741 // will not be flagged as invalid. Per precedent of (osgjava-143) November
742 // 1997 minutes, and (osgjava-340) May 1998 minutes: specifications section
743 -// (new FloatingPointCheck()).run (spec.harness.Context.getSpeed());
744 +// (new FloatingPointCheck()).run (spec.harness.System.getSpeed());
746 - Context.out.println("****** PepTest found an error ******");
747 + System.out.println("****** PepTest found an error ******");
749 - Context.out.println("****** PepTest completed ******");
750 + System.out.println("****** PepTest completed ******");
753 public static void main(String[] args) {
754 diff -u check1/Sub.java check/Sub.java
755 --- check1/Sub.java Wed Jun 17 22:14:14 1998
756 +++ check/Sub.java Fri Oct 25 16:12:54 2002
758 * See what happens here where we subclass Super
761 -package spec.benchmarks._200_check;
763 public class Sub extends Super{
765 ///////////////////////////////////////
766 diff -u check1/Super.java check/Super.java
767 --- check1/Super.java Wed Jun 17 22:14:15 1998
768 +++ check/Super.java Fri Oct 25 16:13:01 2002
770 * This source code is provided as is, without any express or implied warranty.
773 -package spec.benchmarks._200_check;
777 ///////////////////////////////////////