diff options
author | mihaylov <mihaylov@epfl.ch> | 2005-09-27 08:24:43 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2005-09-27 08:24:43 +0000 |
commit | ff21a4fbafeb04afbd4dade2a217a4de2ab034f9 (patch) | |
tree | 6ed4066269260129cb3085deded9374f8b1f6b9d /test | |
parent | 5f6f5f723b884cd41d1233340590e2bf95d90588 (diff) | |
download | scala-ff21a4fbafeb04afbd4dade2a217a4de2ab034f9.tar.gz scala-ff21a4fbafeb04afbd4dade2a217a4de2ab034f9.tar.bz2 scala-ff21a4fbafeb04afbd4dade2a217a4de2ab034f9.zip |
Made platform independant
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/Course-2002-01.scala | 126 | ||||
-rw-r--r-- | test/files/run/Course-2002-02.scala | 372 | ||||
-rw-r--r-- | test/files/run/Course-2002-04.scala | 144 | ||||
-rw-r--r-- | test/files/run/Course-2002-05.scala | 102 | ||||
-rw-r--r-- | test/files/run/Course-2002-08.scala | 124 | ||||
-rw-r--r-- | test/files/run/NestedClasses.scala | 20 | ||||
-rw-r--r-- | test/files/run/boolexprs.scala | 14 | ||||
-rw-r--r-- | test/files/run/bridges.scala | 16 | ||||
-rw-r--r-- | test/files/run/constructors.scala | 12 | ||||
-rw-r--r-- | test/files/run/enums.scala | 13 | ||||
-rw-r--r-- | test/files/run/exceptions.scala | 12 | ||||
-rw-r--r-- | test/files/run/imports.scala | 16 | ||||
-rw-r--r-- | test/files/run/iq.scala | 30 | ||||
-rw-r--r-- | test/files/run/iterators.scala | 14 | ||||
-rw-r--r-- | test/files/run/lists.scala | 14 | ||||
-rw-r--r-- | test/files/run/literals.scala | 21 | ||||
-rw-r--r-- | test/files/run/overloads.scala | 12 | ||||
-rw-r--r-- | test/files/run/tailcalls.scala | 21 |
18 files changed, 528 insertions, 555 deletions
diff --git a/test/files/run/Course-2002-01.scala b/test/files/run/Course-2002-01.scala index 1e97cf0886..b31d1016fd 100644 --- a/test/files/run/Course-2002-01.scala +++ b/test/files/run/Course-2002-01.scala @@ -7,9 +7,9 @@ object M0 { //########################################################################## - java.lang.System.out.println(87 + 145); - java.lang.System.out.println(1000 - 333); - java.lang.System.out.println(5 + 2 * 3); + Console.println(87 + 145); + Console.println(1000 - 333); + Console.println(5 + 2 * 3); //########################################################################## @@ -18,24 +18,24 @@ object M0 { def radius = 10; def circumference = 2 * pi * radius; - java.lang.System.out.println(5 * size); - java.lang.System.out.println(2 * pi * radius); - java.lang.System.out.println(circumference); - java.lang.System.out.println((2 * pi) * radius); + Console.println(5 * size); + Console.println(2 * pi * radius); + Console.println(circumference); + Console.println((2 * pi) * radius); //########################################################################## def square(x: Double) = x * x; - java.lang.System.out.println(square(2)); - java.lang.System.out.println(square(5 + 4)); - java.lang.System.out.println(square(square(4))); + Console.println(square(2)); + Console.println(square(5 + 4)); + Console.println(square(square(4))); //########################################################################## def sumOfSquares(x: Double, y: Double) = square(x) + square(y); - java.lang.System.out.println(sumOfSquares(3, 2+2)); + Console.println(sumOfSquares(3, 2+2)); //########################################################################## @@ -43,17 +43,17 @@ object M0 { def first(x: Int, y: Int) = x; def constOne(x: Int, y: => Int) = 1; - java.lang.System.out.println(constOne(1, loop)); + Console.println(constOne(1, loop)); //########################################################################## def abs(x: Double) = if (x >= 0) x else -x; - java.lang.System.out.println(abs(737)); - java.lang.System.out.println(abs(1)); - java.lang.System.out.println(abs(0)); - java.lang.System.out.println(abs(-1)); - java.lang.System.out.println(abs(-76)); + Console.println(abs(737)); + Console.println(abs(1)); + Console.println(abs(0)); + Console.println(abs(-1)); + Console.println(abs(-76)); //########################################################################## @@ -69,9 +69,9 @@ object M0 { def sqrt0(x: Double) = sqrtIter0(1.0, x); - java.lang.System.out.println(sqrt0(2)); - java.lang.System.out.println(sqrt0(3)); - java.lang.System.out.println(sqrt0(4)); + Console.println(sqrt0(2)); + Console.println(sqrt0(3)); + Console.println(sqrt0(4)); //########################################################################## @@ -89,9 +89,9 @@ object M0 { sqrtIter1(1.0, x) } - java.lang.System.out.println(sqrt1(2)); - java.lang.System.out.println(sqrt1(3)); - java.lang.System.out.println(sqrt1(4)); + Console.println(sqrt1(2)); + Console.println(sqrt1(3)); + Console.println(sqrt1(4)); //########################################################################## @@ -109,9 +109,9 @@ object M0 { sqrtIter2(1.0) } - java.lang.System.out.println(sqrt2(2)); - java.lang.System.out.println(sqrt2(3)); - java.lang.System.out.println(sqrt2(4)); + Console.println(sqrt2(2)); + Console.println(sqrt2(3)); + Console.println(sqrt2(4)); //########################################################################## } @@ -134,7 +134,7 @@ object M1 { sqrtIter(1.0, improve(1.0)) } - java.lang.System.out.println("sqrt(2) = " + sqrt(2)); + Console.println("sqrt(2) = " + sqrt(2)); } //############################################################################ @@ -156,7 +156,7 @@ object M2 { sqrtIter(1.0) } - java.lang.System.out.println("sqrt(2) = " + sqrt(2)); + Console.println("sqrt(2) = " + sqrt(2)); } //############################################################################ @@ -178,7 +178,7 @@ object M3 { cbrtIter(1.0) } - java.lang.System.out.println("cbrt(2) = " + cbrt(2)); + Console.println("cbrt(2) = " + cbrt(2)); } //############################################################################ @@ -188,40 +188,40 @@ object M4 { if (c <= 0 || c >= l) 1 else pascal(c - 1, l - 1) + pascal(c, l - 1); - java.lang.System.out.print(pascal(0,0)); - java.lang.System.out.println(); - - java.lang.System.out.print(pascal(0,1)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(1,1)); - java.lang.System.out.println(); - - java.lang.System.out.print(pascal(0,2)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(1,2)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(2,2)); - java.lang.System.out.println(); - - java.lang.System.out.print(pascal(0,3)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(1,3)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(2,3)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(3,3)); - java.lang.System.out.println(); - - java.lang.System.out.print(pascal(0,4)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(1,4)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(2,4)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(3,4)); - java.lang.System.out.print(' '); - java.lang.System.out.print(pascal(4,4)); - java.lang.System.out.println(); + Console.print(pascal(0,0)); + Console.println; + + Console.print(pascal(0,1)); + Console.print(' '); + Console.print(pascal(1,1)); + Console.println; + + Console.print(pascal(0,2)); + Console.print(' '); + Console.print(pascal(1,2)); + Console.print(' '); + Console.print(pascal(2,2)); + Console.println; + + Console.print(pascal(0,3)); + Console.print(' '); + Console.print(pascal(1,3)); + Console.print(' '); + Console.print(pascal(2,3)); + Console.print(' '); + Console.print(pascal(3,3)); + Console.println; + + Console.print(pascal(0,4)); + Console.print(' '); + Console.print(pascal(1,4)); + Console.print(' '); + Console.print(pascal(2,4)); + Console.print(' '); + Console.print(pascal(3,4)); + Console.print(' '); + Console.print(pascal(4,4)); + Console.println; } //############################################################################ diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala index 3aee36d042..00f43501f4 100644 --- a/test/files/run/Course-2002-02.scala +++ b/test/files/run/Course-2002-02.scala @@ -7,9 +7,9 @@ object M0 { def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b); def factorial(n: Int): Int = if (n == 0) 1 else n * factorial(n - 1); - java.lang.System.out.println(gcd(14,21)); - java.lang.System.out.println(factorial(5)); - java.lang.System.out.println(); + Console.println(gcd(14,21)); + Console.println(factorial(5)); + Console.println; } //############################################################################ @@ -37,12 +37,12 @@ object M1 { 4 + sumElements(1,n) } - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -64,12 +64,12 @@ object M2 { 4 + sum(element, 1, n) } - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -84,12 +84,12 @@ object M3 { def sumReciprocals(a: Int, b: Int): Double = sum((x => 1.0/x), a, b); def sumPi(n: Int): Double = 4 + sum((x => 4.0/(4*x+1) - 4.0/(4*x-1)), 1, n); - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -107,12 +107,12 @@ object M4 { def sumReciprocals = sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -128,12 +128,12 @@ object M5 { def sumReciprocals = sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -148,12 +148,12 @@ object M6 { def sumReciprocals = sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -171,12 +171,12 @@ object M7 { def sumReciprocals = sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println; } //############################################################################ @@ -190,9 +190,9 @@ object M8 { val pi = 2 * product(x => x * x)(2, 2, 40) / product(x => x * x)(1, 2,40)/40; - java.lang.System.out.println("pi = " + productPi(20)); - java.lang.System.out.println("pi = " + pi); - java.lang.System.out.println(); + Console.println("pi = " + productPi(20)); + Console.println("pi = " + pi); + Console.println; } //############################################################################ @@ -219,14 +219,14 @@ object M9 { val pi = 2*product(x => 2*x*2*x)(1,20)/product(x =>(2*x-1)*(2*x-1))(1,20)/40; - java.lang.System.out.println(sumInts(1,4)); - java.lang.System.out.println(sumCubes(1,4)); - java.lang.System.out.println(sumReciprocals(1,4)); - java.lang.System.out.println(sumCubes(1, 10) + sumReciprocals(10, 20)); - java.lang.System.out.println("pi = " + sumPi(20)); - java.lang.System.out.println("pi = " + productPi(20)); - java.lang.System.out.println("pi = " + pi); - java.lang.System.out.println(); + Console.println(sumInts(1,4)); + Console.println(sumCubes(1,4)); + Console.println(sumReciprocals(1,4)); + Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)); + Console.println("pi = " + sumPi(20)); + Console.println("pi = " + productPi(20)); + Console.println("pi = " + pi); + Console.println; } //############################################################################ @@ -238,7 +238,7 @@ object MA { def fixedPoint(f: Double => Double)(firstGuess: Double) = { def iterate(guess: Double): Double = { val next = f(guess); - java.lang.System.out.println(next); + Console.println(next); if (isCloseEnough(guess, next)) next else iterate(next) } @@ -246,8 +246,8 @@ object MA { } def sqrt(x: Double) = fixedPoint(y => (y + x / y) / 2)(1.0); - java.lang.System.out.println("sqrt(2) = " + sqrt(2)); - java.lang.System.out.println() + Console.println("sqrt(2) = " + sqrt(2)); + Console.println } //############################################################################ @@ -259,7 +259,7 @@ object MB { def fixedPoint(f: Double => Double)(firstGuess: Double) = { def iterate(guess: Double): Double = { val next = f(guess); - java.lang.System.out.println(next); + Console.println(next); if (isCloseEnough(guess, next)) next else iterate(next) } @@ -268,8 +268,8 @@ object MB { def averageDamp(f: Double => Double)(x: Double) = (x + f(x)) / 2; def sqrt(x: Double) = fixedPoint(averageDamp(y => x/y))(1.0); - java.lang.System.out.println("sqrt(2) = " + sqrt(2)); - java.lang.System.out.println() + Console.println("sqrt(2) = " + sqrt(2)); + Console.println } //############################################################################ @@ -293,31 +293,31 @@ object MC { def factorial(n: Int) = product(x => x)(1 , n); - java.lang.System.out.println( + Console.println( "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)); - java.lang.System.out.println( + Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)); - java.lang.System.out.println( + Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "factorial(0) = " + factorial(0)); - java.lang.System.out.println( + Console.println( "factorial(1) = " + factorial(1)); - java.lang.System.out.println( + Console.println( "factorial(2) = " + factorial(2)); - java.lang.System.out.println( + Console.println( "factorial(3) = " + factorial(3)); - java.lang.System.out.println( + Console.println( "factorial(4) = " + factorial(4)); - java.lang.System.out.println( + Console.println( "factorial(5) = " + factorial(5)); - java.lang.System.out.println(); + Console.println; } //############################################################################ @@ -337,31 +337,31 @@ object MD { def factorial(n: Int) = product(x => x)(1 , n); - java.lang.System.out.println( + Console.println( "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)); - java.lang.System.out.println( + Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)); - java.lang.System.out.println( + Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "factorial(0) = " + factorial(0)); - java.lang.System.out.println( + Console.println( "factorial(1) = " + factorial(1)); - java.lang.System.out.println( + Console.println( "factorial(2) = " + factorial(2)); - java.lang.System.out.println( + Console.println( "factorial(3) = " + factorial(3)); - java.lang.System.out.println( + Console.println( "factorial(4) = " + factorial(4)); - java.lang.System.out.println( + Console.println( "factorial(5) = " + factorial(5)); - java.lang.System.out.println(); + Console.println; } //############################################################################ @@ -381,31 +381,31 @@ object ME { def factorial(n: Int) = product(x => x)(1 , n); - java.lang.System.out.println( + Console.println( "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)); - java.lang.System.out.println( + Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)); - java.lang.System.out.println( + Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)); - java.lang.System.out.println(); + Console.println; - java.lang.System.out.println( + Console.println( "factorial(0) = " + factorial(0)); - java.lang.System.out.println( + Console.println( "factorial(1) = " + factorial(1)); - java.lang.System.out.println( + Console.println( "factorial(2) = " + factorial(2)); - java.lang.System.out.println( + Console.println( "factorial(3) = " + factorial(3)); - java.lang.System.out.println( + Console.println( "factorial(4) = " + factorial(4)); - java.lang.System.out.println( + Console.println( "factorial(5) = " + factorial(5)); - java.lang.System.out.println(); + Console.println; } //############################################################################ @@ -415,16 +415,16 @@ object MF { if (x <= 1) x else fib(x - 2) + fib(x - 1); - java.lang.System.out.println("fib(0) = " + fib(0)); - java.lang.System.out.println("fib(1) = " + fib(1)); - java.lang.System.out.println("fib(2) = " + fib(2)); - java.lang.System.out.println("fib(3) = " + fib(3)); - java.lang.System.out.println("fib(4) = " + fib(4)); - java.lang.System.out.println("fib(5) = " + fib(5)); - java.lang.System.out.println("fib(6) = " + fib(6)); - java.lang.System.out.println("fib(7) = " + fib(7)); - java.lang.System.out.println("fib(8) = " + fib(8)); - java.lang.System.out.println("fib(9) = " + fib(9)); + Console.println("fib(0) = " + fib(0)); + Console.println("fib(1) = " + fib(1)); + Console.println("fib(2) = " + fib(2)); + Console.println("fib(3) = " + fib(3)); + Console.println("fib(4) = " + fib(4)); + Console.println("fib(5) = " + fib(5)); + Console.println("fib(6) = " + fib(6)); + Console.println("fib(7) = " + fib(7)); + Console.println("fib(8) = " + fib(8)); + Console.println("fib(9) = " + fib(9)); } //############################################################################ @@ -437,16 +437,16 @@ object MG { if (x == 0) 0 else loop(1, 0, 1) } - java.lang.System.out.println("fib(0) = " + fib(0)); - java.lang.System.out.println("fib(1) = " + fib(1)); - java.lang.System.out.println("fib(2) = " + fib(2)); - java.lang.System.out.println("fib(3) = " + fib(3)); - java.lang.System.out.println("fib(4) = " + fib(4)); - java.lang.System.out.println("fib(5) = " + fib(5)); - java.lang.System.out.println("fib(6) = " + fib(6)); - java.lang.System.out.println("fib(7) = " + fib(7)); - java.lang.System.out.println("fib(8) = " + fib(8)); - java.lang.System.out.println("fib(9) = " + fib(9)); + Console.println("fib(0) = " + fib(0)); + Console.println("fib(1) = " + fib(1)); + Console.println("fib(2) = " + fib(2)); + Console.println("fib(3) = " + fib(3)); + Console.println("fib(4) = " + fib(4)); + Console.println("fib(5) = " + fib(5)); + Console.println("fib(6) = " + fib(6)); + Console.println("fib(7) = " + fib(7)); + Console.println("fib(8) = " + fib(8)); + Console.println("fib(9) = " + fib(9)); } //############################################################################ @@ -458,71 +458,71 @@ object MH { else x * power(x, y - 1); - java.lang.System.out.println("power(0,0) = " + power(0,0)); - java.lang.System.out.println("power(0,1) = " + power(0,1)); - java.lang.System.out.println("power(0,2) = " + power(0,2)); - java.lang.System.out.println("power(0,3) = " + power(0,3)); - java.lang.System.out.println("power(0,4) = " + power(0,4)); - java.lang.System.out.println("power(0,5) = " + power(0,5)); - java.lang.System.out.println("power(0,6) = " + power(0,6)); - java.lang.System.out.println("power(0,7) = " + power(0,7)); - java.lang.System.out.println("power(0,8) = " + power(0,8)); - java.lang.System.out.println(); - - java.lang.System.out.println("power(1,0) = " + power(1,0)); - java.lang.System.out.println("power(1,1) = " + power(1,1)); - java.lang.System.out.println("power(1,2) = " + power(1,2)); - java.lang.System.out.println("power(1,3) = " + power(1,3)); - java.lang.System.out.println("power(1,4) = " + power(1,4)); - java.lang.System.out.println("power(1,5) = " + power(1,5)); - java.lang.System.out.println("power(1,6) = " + power(1,6)); - java.lang.System.out.println("power(1,7) = " + power(1,7)); - java.lang.System.out.println("power(1,8) = " + power(1,8)); - java.lang.System.out.println(); - - java.lang.System.out.println("power(2,0) = " + power(2,0)); - java.lang.System.out.println("power(2,1) = " + power(2,1)); - java.lang.System.out.println("power(2,2) = " + power(2,2)); - java.lang.System.out.println("power(2,3) = " + power(2,3)); - java.lang.System.out.println("power(2,4) = " + power(2,4)); - java.lang.System.out.println("power(2,5) = " + power(2,5)); - java.lang.System.out.println("power(2,6) = " + power(2,6)); - java.lang.System.out.println("power(2,7) = " + power(2,7)); - java.lang.System.out.println("power(2,8) = " + power(2,8)); - java.lang.System.out.println(); - - java.lang.System.out.println("power(3,0) = " + power(3,0)); - java.lang.System.out.println("power(3,1) = " + power(3,1)); - java.lang.System.out.println("power(3,2) = " + power(3,2)); - java.lang.System.out.println("power(3,3) = " + power(3,3)); - java.lang.System.out.println("power(3,4) = " + power(3,4)); - java.lang.System.out.println("power(3,5) = " + power(3,5)); - java.lang.System.out.println("power(3,6) = " + power(3,6)); - java.lang.System.out.println("power(3,7) = " + power(3,7)); - java.lang.System.out.println("power(3,8) = " + power(3,8)); - java.lang.System.out.println(); - - java.lang.System.out.println("power(4,0) = " + power(4,0)); - java.lang.System.out.println("power(4,1) = " + power(4,1)); - java.lang.System.out.println("power(4,2) = " + power(4,2)); - java.lang.System.out.println("power(4,3) = " + power(4,3)); - java.lang.System.out.println("power(4,4) = " + power(4,4)); - java.lang.System.out.println("power(4,5) = " + power(4,5)); - java.lang.System.out.println("power(4,6) = " + power(4,6)); - java.lang.System.out.println("power(4,7) = " + power(4,7)); - java.lang.System.out.println("power(4,8) = " + power(4,8)); - java.lang.System.out.println(); - - java.lang.System.out.println("power(5,0) = " + power(5,0)); - java.lang.System.out.println("power(5,1) = " + power(5,1)); - java.lang.System.out.println("power(5,2) = " + power(5,2)); - java.lang.System.out.println("power(5,3) = " + power(5,3)); - java.lang.System.out.println("power(5,4) = " + power(5,4)); - java.lang.System.out.println("power(5,5) = " + power(5,5)); - java.lang.System.out.println("power(5,6) = " + power(5,6)); - java.lang.System.out.println("power(5,7) = " + power(5,7)); - java.lang.System.out.println("power(5,8) = " + power(5,8)); - java.lang.System.out.println(); + Console.println("power(0,0) = " + power(0,0)); + Console.println("power(0,1) = " + power(0,1)); + Console.println("power(0,2) = " + power(0,2)); + Console.println("power(0,3) = " + power(0,3)); + Console.println("power(0,4) = " + power(0,4)); + Console.println("power(0,5) = " + power(0,5)); + Console.println("power(0,6) = " + power(0,6)); + Console.println("power(0,7) = " + power(0,7)); + Console.println("power(0,8) = " + power(0,8)); + Console.println; + + Console.println("power(1,0) = " + power(1,0)); + Console.println("power(1,1) = " + power(1,1)); + Console.println("power(1,2) = " + power(1,2)); + Console.println("power(1,3) = " + power(1,3)); + Console.println("power(1,4) = " + power(1,4)); + Console.println("power(1,5) = " + power(1,5)); + Console.println("power(1,6) = " + power(1,6)); + Console.println("power(1,7) = " + power(1,7)); + Console.println("power(1,8) = " + power(1,8)); + Console.println; + + Console.println("power(2,0) = " + power(2,0)); + Console.println("power(2,1) = " + power(2,1)); + Console.println("power(2,2) = " + power(2,2)); + Console.println("power(2,3) = " + power(2,3)); + Console.println("power(2,4) = " + power(2,4)); + Console.println("power(2,5) = " + power(2,5)); + Console.println("power(2,6) = " + power(2,6)); + Console.println("power(2,7) = " + power(2,7)); + Console.println("power(2,8) = " + power(2,8)); + Console.println; + + Console.println("power(3,0) = " + power(3,0)); + Console.println("power(3,1) = " + power(3,1)); + Console.println("power(3,2) = " + power(3,2)); + Console.println("power(3,3) = " + power(3,3)); + Console.println("power(3,4) = " + power(3,4)); + Console.println("power(3,5) = " + power(3,5)); + Console.println("power(3,6) = " + power(3,6)); + Console.println("power(3,7) = " + power(3,7)); + Console.println("power(3,8) = " + power(3,8)); + Console.println; + + Console.println("power(4,0) = " + power(4,0)); + Console.println("power(4,1) = " + power(4,1)); + Console.println("power(4,2) = " + power(4,2)); + Console.println("power(4,3) = " + power(4,3)); + Console.println("power(4,4) = " + power(4,4)); + Console.println("power(4,5) = " + power(4,5)); + Console.println("power(4,6) = " + power(4,6)); + Console.println("power(4,7) = " + power(4,7)); + Console.println("power(4,8) = " + power(4,8)); + Console.println; + + Console.println("power(5,0) = " + power(5,0)); + Console.println("power(5,1) = " + power(5,1)); + Console.println("power(5,2) = " + power(5,2)); + Console.println("power(5,3) = " + power(5,3)); + Console.println("power(5,4) = " + power(5,4)); + Console.println("power(5,5) = " + power(5,5)); + Console.println("power(5,6) = " + power(5,6)); + Console.println("power(5,7) = " + power(5,7)); + Console.println("power(5,8) = " + power(5,8)); + Console.println; } //############################################################################ diff --git a/test/files/run/Course-2002-04.scala b/test/files/run/Course-2002-04.scala index d14af43a96..31aaa44c23 100644 --- a/test/files/run/Course-2002-04.scala +++ b/test/files/run/Course-2002-04.scala @@ -3,8 +3,6 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - object M0 { def quicksort[a] (less : (a,a) => Boolean) (xs : List[a]) : List[a] = { @@ -30,14 +28,14 @@ object M0 { val list5 = quicksort[Int]((x,y) => x >= y)(list0); val list6 = quicksort[Int]((x,y) => x >= y)(list1); - System.out.println("list0 = " + list0); - System.out.println("list1 = " + list1); - System.out.println("list2 = " + list2); - System.out.println("list3 = " + list3); - System.out.println("list4 = " + list4); - System.out.println("list5 = " + list5); - System.out.println("list6 = " + list6); - System.out.println(); + Console.println("list0 = " + list0); + Console.println("list1 = " + list1); + Console.println("list2 = " + list2); + Console.println("list3 = " + list3); + Console.println("list4 = " + list4); + Console.println("list5 = " + list5); + Console.println("list6 = " + list6); + Console.println; } } @@ -108,18 +106,18 @@ object M1 { val list9 = List(2,1,0); val listA = List(6,3,1,8,7,1,2,5,8,4); - System.out.println("list0: " + list0 + " -> " + isort(list0)); - System.out.println("list1: " + list1 + " -> " + isort(list1)); - System.out.println("list2: " + list2 + " -> " + isort(list2)); - System.out.println("list3: " + list3 + " -> " + isort(list3)); - System.out.println("list4: " + list4 + " -> " + isort(list4)); - System.out.println("list5: " + list5 + " -> " + isort(list5)); - System.out.println("list6: " + list6 + " -> " + isort(list6)); - System.out.println("list7: " + list7 + " -> " + isort(list7)); - System.out.println("list8: " + list8 + " -> " + isort(list8)); - System.out.println("list9: " + list9 + " -> " + isort(list9)); - System.out.println("listA: " + listA + " -> " + isort(listA)); - System.out.println(); + Console.println("list0: " + list0 + " -> " + isort(list0)); + Console.println("list1: " + list1 + " -> " + isort(list1)); + Console.println("list2: " + list2 + " -> " + isort(list2)); + Console.println("list3: " + list3 + " -> " + isort(list3)); + Console.println("list4: " + list4 + " -> " + isort(list4)); + Console.println("list5: " + list5 + " -> " + isort(list5)); + Console.println("list6: " + list6 + " -> " + isort(list6)); + Console.println("list7: " + list7 + " -> " + isort(list7)); + Console.println("list8: " + list8 + " -> " + isort(list8)); + Console.println("list9: " + list9 + " -> " + isort(list9)); + Console.println("listA: " + listA + " -> " + isort(listA)); + Console.println; } } @@ -137,12 +135,12 @@ object M2 { def test = { val poly = List(9.0,5.0,7.0,5.0); - System.out.println("f(x) = 5x^3+7x^2+5x+9"); - System.out.println("f(0) = " + horner(0, poly)); - System.out.println("f(1) = " + horner(1, poly)); - System.out.println("f(2) = " + horner(2, poly)); - System.out.println("f(3) = " + horner(3, poly)); - System.out.println(); + Console.println("f(x) = 5x^3+7x^2+5x+9"); + Console.println("f(0) = " + horner(0, poly)); + Console.println("f(1) = " + horner(1, poly)); + Console.println("f(2) = " + horner(2, poly)); + Console.println("f(3) = " + horner(3, poly)); + Console.println; } } @@ -184,51 +182,51 @@ object M3 { def v = List(2.0,3.0,4.0); - System.out.println("v1 = " + v1); - System.out.println("v2 = " + v2); - System.out.println(); - - System.out.println("id = " + id); - System.out.println("m1 = " + m1); - System.out.println("m2 = " + m2); - System.out.println(); - - System.out.println("v1 * v1 = " + dotproduct(v1,v1)); - System.out.println("v1 * v2 = " + dotproduct(v1,v2)); - System.out.println("v2 * v1 = " + dotproduct(v2,v1)); - System.out.println("v1 * v2 = " + dotproduct(v1,v2)); - System.out.println(); - - System.out.println("id * v1 = " + matrixTimesVector(id,v1)); - System.out.println("m1 * v1 = " + matrixTimesVector(m1,v1)); - System.out.println("m2 * v1 = " + matrixTimesVector(m2,v1)); - System.out.println(); - - System.out.println("trn(id) = " + transpose(id)); - System.out.println("trn(m1) = " + transpose(m1)); - System.out.println("trn(m2) = " + transpose(m2)); - System.out.println(); - - System.out.println("List(v1) * id = " + matrixTimesMatrix(List(v1),id)); - System.out.println("List(v1) * m1 = " + matrixTimesMatrix(List(v1),m1)); - System.out.println("List(v1) * m2 = " + matrixTimesMatrix(List(v1),m2)); - System.out.println(); - - System.out.println("id * List(v1) = " + matrixTimesMatrix(id,List(v1))); - System.out.println("m1 * List(v1) = " + matrixTimesMatrix(m1,List(v1))); - System.out.println("m2 * List(v1) = " + matrixTimesMatrix(m2,List(v1))); - System.out.println(); - - System.out.println("id * id = " + matrixTimesMatrix(id,id)); - System.out.println("id * m1 = " + matrixTimesMatrix(id,m1)); - System.out.println("m1 * id = " + matrixTimesMatrix(m1,id)); - System.out.println("m1 * m1 = " + matrixTimesMatrix(m1,m1)); - System.out.println("id * m2 = " + matrixTimesMatrix(id,m2)); - System.out.println("m2 * id = " + matrixTimesMatrix(m2,id)); - System.out.println("m1 * m2 = " + matrixTimesMatrix(m1,m2)); - System.out.println("m2 * m1 = " + matrixTimesMatrix(m2,m1)); - System.out.println("m2 * m2 = " + matrixTimesMatrix(m2,m2)); - System.out.println(); + Console.println("v1 = " + v1); + Console.println("v2 = " + v2); + Console.println; + + Console.println("id = " + id); + Console.println("m1 = " + m1); + Console.println("m2 = " + m2); + Console.println; + + Console.println("v1 * v1 = " + dotproduct(v1,v1)); + Console.println("v1 * v2 = " + dotproduct(v1,v2)); + Console.println("v2 * v1 = " + dotproduct(v2,v1)); + Console.println("v1 * v2 = " + dotproduct(v1,v2)); + Console.println; + + Console.println("id * v1 = " + matrixTimesVector(id,v1)); + Console.println("m1 * v1 = " + matrixTimesVector(m1,v1)); + Console.println("m2 * v1 = " + matrixTimesVector(m2,v1)); + Console.println; + + Console.println("trn(id) = " + transpose(id)); + Console.println("trn(m1) = " + transpose(m1)); + Console.println("trn(m2) = " + transpose(m2)); + Console.println; + + Console.println("List(v1) * id = " + matrixTimesMatrix(List(v1),id)); + Console.println("List(v1) * m1 = " + matrixTimesMatrix(List(v1),m1)); + Console.println("List(v1) * m2 = " + matrixTimesMatrix(List(v1),m2)); + Console.println; + + Console.println("id * List(v1) = " + matrixTimesMatrix(id,List(v1))); + Console.println("m1 * List(v1) = " + matrixTimesMatrix(m1,List(v1))); + Console.println("m2 * List(v1) = " + matrixTimesMatrix(m2,List(v1))); + Console.println; + + Console.println("id * id = " + matrixTimesMatrix(id,id)); + Console.println("id * m1 = " + matrixTimesMatrix(id,m1)); + Console.println("m1 * id = " + matrixTimesMatrix(m1,id)); + Console.println("m1 * m1 = " + matrixTimesMatrix(m1,m1)); + Console.println("id * m2 = " + matrixTimesMatrix(id,m2)); + Console.println("m2 * id = " + matrixTimesMatrix(m2,id)); + Console.println("m1 * m2 = " + matrixTimesMatrix(m1,m2)); + Console.println("m2 * m1 = " + matrixTimesMatrix(m2,m1)); + Console.println("m2 * m2 = " + matrixTimesMatrix(m2,m2)); + Console.println; } } diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala index 3d6c8ebdcb..6f40f7f99e 100644 --- a/test/files/run/Course-2002-05.scala +++ b/test/files/run/Course-2002-05.scala @@ -3,8 +3,6 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - object M0 { def partition[a](xs: List[a], pred: a => boolean): Pair[List[a], List[a]] = { if (xs.isEmpty) @@ -29,23 +27,23 @@ object M0 { } def test = { - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 0))); - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 5))); - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 9))); - System.out.println(); - - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 0))); - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 5))); - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 9))); - System.out.println(); - - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 0))); - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 5))); - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 9))); - System.out.println(); - - System.out.println(quicksort[int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); - System.out.println(); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 0))); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 5))); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 9))); + Console.println; + + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 0))); + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 5))); + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 9))); + Console.println; + + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 0))); + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 5))); + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 9))); + Console.println; + + Console.println(quicksort[int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); + Console.println; } } @@ -69,23 +67,23 @@ object M1 { } def test = { - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 0))); - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 5))); - System.out.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 9))); - System.out.println(); - - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 0))); - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 5))); - System.out.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 9))); - System.out.println(); - - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 0))); - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 5))); - System.out.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 9))); - System.out.println(); - - System.out.println(quicksort[int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); - System.out.println(); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 0))); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 5))); + Console.println(partition[int](List(1,2,3,4,5,6,7,8), (x => x < 9))); + Console.println; + + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 0))); + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 5))); + Console.println(partition[int](List(8,7,6,5,4,3,2,1), (x => x < 9))); + Console.println; + + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 0))); + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 5))); + Console.println(partition[int](List(7,2,1,5,4,3,8,6), (x => x < 9))); + Console.println; + + Console.println(quicksort[int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); + Console.println; } } @@ -104,12 +102,12 @@ object M2 { } def test = { - System.out.println(powerset(List())); - System.out.println(powerset(List(1))); - System.out.println(powerset(List(1,2))); - System.out.println(powerset(List(1,2,3))); - System.out.println(powerset(List(1,2,3,4))); - System.out.println(); + Console.println(powerset(List())); + Console.println(powerset(List(1))); + Console.println(powerset(List(1,2))); + Console.println(powerset(List(1,2,3))); + Console.println(powerset(List(1,2,3,4))); + Console.println; } } @@ -148,11 +146,11 @@ object M3 { } def test = { - System.out.println("queens(1) = " + queens(1)); - System.out.println("queens(2) = " + queens(2)); - System.out.println("queens(3) = " + queens(3)); - System.out.println("queens(4) = " + queens(4)); - System.out.println(); + Console.println("queens(1) = " + queens(1)); + Console.println("queens(2) = " + queens(2)); + Console.println("queens(3) = " + queens(3)); + Console.println("queens(4) = " + queens(4)); + Console.println; } } @@ -193,11 +191,11 @@ object M4 { } def test = { - System.out.println("queens(1) = " + queens(1)); - System.out.println("queens(2) = " + queens(2)); - System.out.println("queens(3) = " + queens(3)); - System.out.println("queens(4) = " + queens(4)); - System.out.println(); + Console.println("queens(1) = " + queens(1)); + Console.println("queens(2) = " + queens(2)); + Console.println("queens(3) = " + queens(3)); + Console.println("queens(4) = " + queens(4)); + Console.println; } } diff --git a/test/files/run/Course-2002-08.scala b/test/files/run/Course-2002-08.scala index 0c0926fa09..7e06001732 100644 --- a/test/files/run/Course-2002-08.scala +++ b/test/files/run/Course-2002-08.scala @@ -3,8 +3,6 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - import List._; object M0 { @@ -13,13 +11,13 @@ object M0 { var count = 111; def test = { - System.out.println("x = " + x); - System.out.println("count = " + count); + Console.println("x = " + x); + Console.println("count = " + count); x = "hello"; count = count + 1; - System.out.println("x = " + x); - System.out.println("count = " + count); - System.out.println(); + Console.println("x = " + x); + Console.println("count = " + count); + Console.println; } } @@ -41,48 +39,48 @@ object M1 { def test0 = { val account = new BankAccount(); - System.out.print("account deposit 50 -> "); - System.out.println((account deposit 50).toString()); // !!! .toString - System.out.print("account withdraw 20 -> "); - System.out.println(account withdraw 20); - System.out.print("account withdraw 20 -> "); - System.out.println(account withdraw 20); - System.out.print("account withdraw 15 -> "); - System.out.println(/* !!! account withdraw 15*/); + Console.print("account deposit 50 -> "); + Console.println((account deposit 50).toString()); // !!! .toString + Console.print("account withdraw 20 -> "); + Console.println(account withdraw 20); + Console.print("account withdraw 20 -> "); + Console.println(account withdraw 20); + Console.print("account withdraw 15 -> "); + Console.println; } def test1 = { val x = new BankAccount(); val y = new BankAccount(); - System.out.print("x deposit 30 -> "); - System.out.println((x deposit 30).toString()); // !!! .toString - System.out.print("y withdraw 20 -> "); - System.out.println(/* !!! y withdraw 20 */); + Console.print("x deposit 30 -> "); + Console.println((x deposit 30).toString()); // !!! .toString + Console.print("y withdraw 20 -> "); + Console.println; } def test2 = { val x = new BankAccount(); val y = new BankAccount(); - System.out.print("x deposit 30 -> "); - System.out.println((x deposit 30).toString()); // !!! .toString - System.out.print("x withdraw 20 -> "); - System.out.println(x withdraw 20); + Console.print("x deposit 30 -> "); + Console.println((x deposit 30).toString()); // !!! .toString + Console.print("x withdraw 20 -> "); + Console.println(x withdraw 20); } def test3 = { val x = new BankAccount(); val y = x; - System.out.print("x deposit 30 -> "); - System.out.println((x deposit 30).toString()); // !!! .toString - System.out.print("y withdraw 20 -> "); - System.out.println(y withdraw 20); + Console.print("x deposit 30 -> "); + Console.println((x deposit 30).toString()); // !!! .toString + Console.print("y withdraw 20 -> "); + Console.println(y withdraw 20); } def test = { - test0; System.out.println(); - test1; System.out.println(); - test2; System.out.println(); - test3; System.out.println(); + test0; Console.println; + test1; Console.println; + test2; Console.println; + test3; Console.println; } } @@ -105,11 +103,11 @@ object M2 { } def test = { - System.out.println("2^0 = " + power(2,0)); - System.out.println("2^1 = " + power(2,1)); - System.out.println("2^2 = " + power(2,2)); - System.out.println("2^3 = " + power(2,3)); - System.out.println(); + Console.println("2^0 = " + power(2,0)); + Console.println("2^1 = " + power(2,1)); + Console.println("2^2 = " + power(2,2)); + Console.println("2^3 = " + power(2,3)); + Console.println; } } @@ -125,11 +123,11 @@ object M3 { } def test = { - System.out.println("2^0 = " + power(2,0)); - System.out.println("2^1 = " + power(2,1)); - System.out.println("2^2 = " + power(2,2)); - System.out.println("2^3 = " + power(2,3)); - System.out.println(); + Console.println("2^0 = " + power(2,0)); + Console.println("2^1 = " + power(2,1)); + Console.println("2^2 = " + power(2,2)); + Console.println("2^3 = " + power(2,3)); + Console.println; } } @@ -138,10 +136,10 @@ object M3 { object M4 { def test = { - for (val i <- range(1, 4)) { System.out.print(i + " ") }; - System.out.println(); - System.out.println(for (val i <- range(1, 4)) yield i); - System.out.println(); + for (val i <- range(1, 4)) { Console.print(i + " ") }; + Console.println; + Console.println(for (val i <- range(1, 4)) yield i); + Console.println; } } @@ -192,7 +190,7 @@ object M5 { } def run: Unit = { - afterDelay(0){() => System.out.println("*** simulation started ***"); } + afterDelay(0){() => Console.println("*** simulation started ***"); } while (!agenda.isEmpty) { next } } } @@ -233,7 +231,7 @@ object M5 { def probe(name: String, wire: Wire): Unit = { wire addAction {() => - System.out.println( + Console.println( name + " " + currentTime + " new-value = " + wire.getSignal); } } @@ -276,8 +274,8 @@ object M5 { def test(a: Int) = { ain setSignal (if (a == 0) false else true); run; - System.out.println("!" + a + " = " + result); - System.out.println(); + Console.println("!" + a + " = " + result); + Console.println; } probe("out ", cout); @@ -298,12 +296,12 @@ object M5 { ain setSignal (if (a == 0) false else true); bin setSignal (if (b == 0) false else true); run; - System.out.println(a + " & " + b + " = " + result); - System.out.println(); + Console.println(a + " & " + b + " = " + result); + Console.println; } probe("out ", cout); - System.out.println(); + Console.println; test(0,0); test(0,1); @@ -323,12 +321,12 @@ object M5 { ain setSignal (if (a == 0) false else true); bin setSignal (if (b == 0) false else true); run; - System.out.println(a + " | " + b + " = " + result); - System.out.println(); + Console.println(a + " | " + b + " = " + result); + Console.println; } probe("out ", cout); - System.out.println(); + Console.println; test(0,0); test(0,1); @@ -351,13 +349,13 @@ object M5 { ain setSignal (if (a == 0) false else true); bin setSignal (if (b == 0) false else true); run; - System.out.println(a + " + " + b + " = " + result); - System.out.println(); + Console.println(a + " + " + b + " = " + result); + Console.println; } probe("sum ", sout); probe("carry", cout); - System.out.println(); + Console.println; test(0,0); test(0,1); @@ -382,13 +380,13 @@ object M5 { bin setSignal (if (b == 0) false else true); cin setSignal (if (c == 0) false else true); run; - System.out.println(a + " + " + b + " + " + c + " = " + result); - System.out.println(); + Console.println(a + " + " + b + " + " + c + " = " + result); + Console.println; } probe("sum ", sout); probe("carry", cout); - System.out.println(); + Console.println; test(0,0,0); test(0,0,1); @@ -444,7 +442,7 @@ class Simulator() { protected def currentTime: Int = curtime; def run = { - afterDelay(0){() => System.out.println("*** simulation started ***"); } + afterDelay(0){() => Console.println("*** simulation started ***"); } while (!agenda.isEmpty) { next } } } @@ -468,7 +466,7 @@ abstract class BasicCircuitSimulator() extends Simulator() { def probe(name: String, wire: Wire): Unit = { wire addAction {() => - System.out.println( + Console.println( name + " " + currentTime + " new-value = " + wire.getSignal); } } diff --git a/test/files/run/NestedClasses.scala b/test/files/run/NestedClasses.scala index 88f1631166..07f8d62c12 100644 --- a/test/files/run/NestedClasses.scala +++ b/test/files/run/NestedClasses.scala @@ -69,31 +69,29 @@ class AAA1 extends AAA { } object Test { - import java.lang.System; // to avoid name clash with .NET's library - def main(args: Array[String]): Unit = { val a = new A1(12); val d = new a.D; val e = new d.E; - System.out.println("e.e1 = " + e.e1); + Console.println("e.e1 = " + e.e1); val aa = new AA; val bb = new aa.BB; val cc = new bb.CC; - System.out.println("cc.m = " + cc.m); - System.out.println("cc.am = " + cc.am); - System.out.println("cc.bm = " + cc.bm); + Console.println("cc.m = " + cc.m); + Console.println("cc.am = " + cc.am); + Console.println("cc.bm = " + cc.bm); val aaa = new AAA1; val bbb1 = new aaa.BBB1; val bbb2 = new aaa.BBB2; val bbb3 = new aaa.BBB3; val bbb4 = new aaa.BBB4; - System.out.println("aaa.f = " + aaa.f); - System.out.println("bbb1.f = " + bbb1.f); - System.out.println("bbb2.f = " + bbb2.f); - System.out.println("bbb3.f = " + bbb3.f); - System.out.println("bbb4.f = " + bbb4.f); + Console.println("aaa.f = " + aaa.f); + Console.println("bbb1.f = " + bbb1.f); + Console.println("bbb2.f = " + bbb2.f); + Console.println("bbb3.f = " + bbb3.f); + Console.println("bbb4.f = " + bbb4.f); } } diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala index b5bc5f7787..7080f84b56 100644 --- a/test/files/run/boolexprs.scala +++ b/test/files/run/boolexprs.scala @@ -34,29 +34,27 @@ object Test2 { // Test code object Test { - import java.lang.System; - def check_success(name: String, closure: => Int, expected: Int): Unit = { - System.out.print("test " + name); + Console.print("test " + name); try { val actual: Int = closure; if (actual == expected) { - System.out.print(" was successful"); + Console.print(" was successful"); } else { - System.out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } } catch { case exception: Throwable => { - System.out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - System.out.println(); + Console.println; } def main(args: Array[String]): Unit = { check_success("Test1", Test1.run, 1); check_success("Test2", Test2.run, 0); - System.out.println(); + Console.println; } } diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala index ce76ae33b5..5d61608d36 100644 --- a/test/files/run/bridges.scala +++ b/test/files/run/bridges.scala @@ -3,8 +3,6 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - class A; class B; class C; @@ -28,7 +26,7 @@ object Help { } def print: Unit = { var i = 0; - while (i < max) { if (i > 0) System.out.print(", "); System.out.print(vars(i)); i = i + 1; } + while (i < max) { if (i > 0) Console.print(", "); Console.print(vars(i)); i = i + 1; } } def foo = { vars(next) = "foo"; next = next + 1; } def bar = { vars(next) = "bar"; next = next + 1; } @@ -3585,15 +3583,15 @@ object Test { Help.init; test; if (!Help.check(count, value)) { - System.out.print(name + " failed: "); + Console.print(name + " failed: "); Help.print; - System.out.println(); + Console.println; errors = errors + 1; } } catch { case exception => { - System.out.print(name + " raised exception " + exception); - System.out.println(); + Console.print(name + " raised exception " + exception); + Console.println; errors = errors + 1; } } @@ -7118,8 +7116,8 @@ object Test { // */test("S_TZIfwFooXIfwBarYIf", new S_TZIfwFooXIfwBarYIf[D], 4, "mix"); if (errors > 0) { - System.out.println(); - System.out.println(errors + " error" + (if (errors > 1) "s" else "")); + Console.println; + Console.println(errors + " error" + (if (errors > 1) "s" else "")); } } } diff --git a/test/files/run/constructors.scala b/test/files/run/constructors.scala index f46088fa00..e85f3b8667 100644 --- a/test/files/run/constructors.scala +++ b/test/files/run/constructors.scala @@ -2,8 +2,6 @@ // Test constructors, including multiple ones. -import java.lang.System; // to avoid name clash with .NET's library - class A(x: Int, y: Int) { def this(x: Int) = this(x, x); def this() = this(1); @@ -22,10 +20,10 @@ object Test { val a3 = new A(); val b1 = new a1.B(1,2,"a"); val b2 = new a2.B("b"); - System.out.println(a1); - System.out.println(a2); - System.out.println(a3); - System.out.println(b1); - System.out.println(b2); + Console.println(a1); + Console.println(a2); + Console.println(a3); + Console.println(b1); + Console.println(b2); } } diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala index 5af6577ba3..2332fb87d4 100644 --- a/test/files/run/enums.scala +++ b/test/files/run/enums.scala @@ -51,30 +51,29 @@ object Test3 { // Test code object Test { - import java.lang.System; def check_success(name: String, closure: => Int, expected: Int): Unit = { - System.out.print("test " + name); + Console.print("test " + name); try { val actual: Int = closure; if (actual == expected) { - System.out.print(" was successful"); + Console.print(" was successful"); } else { - System.out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } } catch { case exception: Throwable => { - System.out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - System.out.println(); + Console.println; } def main(args: Array[String]): Unit = { check_success("Test1", Test1.run, 5); check_success("Test2", Test2.run, 5); check_success("Test3", Test3.run, 1); - System.out.println(); + Console.println; } } diff --git a/test/files/run/exceptions.scala b/test/files/run/exceptions.scala index 1165308464..7743f25ef9 100644 --- a/test/files/run/exceptions.scala +++ b/test/files/run/exceptions.scala @@ -5,8 +5,6 @@ //############################################################################ -import java.lang.System; // to avoid name clash with .NET's library - abstract class IntMap[A] { def lookup(key: Int): A = match { case Empty() => error("KO") @@ -20,13 +18,13 @@ object exceptions { def check(what: String, actual: Any, expected: Any): Unit = { val success: Boolean = actual == expected; - System.out.print(if (success) "ok" else "KO"); + Console.print(if (success) "ok" else "KO"); var value: String = if (actual == null) "null" else actual.toString(); if (value == "\u0000") value = "\\u0000"; - System.out.print(": " + what + " = " + value); - if (!success) System.out.print(" != " + expected); - System.out.println(); - System.out.flush(); + Console.print(": " + what + " = " + value); + if (!success) Console.print(" != " + expected); + Console.println; + Console.flush; } def test: Unit = { diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala index 94b10f5b51..d976478d8b 100644 --- a/test/files/run/imports.scala +++ b/test/files/run/imports.scala @@ -3,18 +3,16 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - //############################################################################ object checker { def check(where: String, what: String, value: Any): Unit = { - System.out.print("In " + where + ", " + what + ".toString() returns "); - System.out.flush(); + Console.print("In " + where + ", " + what + ".toString() returns "); + Console.flush; val string: String = if (value == null) "null" else value.toString(); val test = if (string == where) "ok" else "KO"; - System.out.println(string + " -> " + test); - System.out.flush(); + Console.println(string + " -> " + test); + Console.flush; } } @@ -34,7 +32,7 @@ class C_ico() { check("C_ico", "v_ico ", v_ico); check("C_ico", "field ", field); check("C_ico", "method", method); - System.out.println(); + Console.println; } object o_ico { @@ -61,7 +59,7 @@ class C_ioc() { check("C_ioc", "v_ioc ", v_ioc); check("C_ioc", "field ", field); check("C_ioc", "method", method); - System.out.println(); + Console.println; } //############################################################################ @@ -82,7 +80,7 @@ class C_oic() { check("C_oic", "v_oic ", v_oic); check("C_oic", "field ", field); check("C_oic", "method", method); - System.out.println(); + Console.println; } //############################################################################ diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index dd0ce3f3d2..87bbe45cd7 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -13,7 +13,7 @@ object iq { * Expected: Empty */ if(q.isEmpty) { - java.lang.System.out.println("Empty"); + Console.println("Empty"); } /* Test infix enqueing. */ @@ -24,11 +24,11 @@ object iq { */ val q4 = if(q2.isEmpty) { - java.lang.System.out.println("Empty"); + Console.println("Empty"); q2; } else { val Pair(head,q3) = q2.dequeue; - java.lang.System.out.println("Head: " + head); + Console.println("Head: " + head); q3; }; @@ -37,11 +37,11 @@ object iq { /* Test toString. * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) */ - java.lang.System.out.println("q5: " + q5); + Console.println("q5: " + q5); /* Test apply * Expected: q5[5]: 5 */ - java.lang.System.out.println("q5[5]: " + q5(5)); + Console.println("q5[5]: " + q5(5)); @@ -51,8 +51,8 @@ object iq { * Expected: q5 == q9: true * q9 == q5: true */ - java.lang.System.out.println("q5 == q5c: " + (q5 == q5c)); - java.lang.System.out.println("q5c == q5: " + (q5c == q5)); + Console.println("q5 == q5c: " + (q5 == q5c)); + Console.println("q5c == q5: " + (q5c == q5)); val Pair(_,q6) = q5.dequeue; val Pair(_,q7) = q6.dequeue; @@ -60,35 +60,35 @@ object iq { /* Test dequeu * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) */ - java.lang.System.out.println("q8: " + q8); + Console.println("q8: " + q8); val q9 = new Queue(2,3,4,5,6,7,8,9,10,11); /* Testing == * Expected: q8 == q9: true */ - java.lang.System.out.println("q8 == q9: " + (q8 == q9)); + Console.println("q8 == q9: " + (q8 == q9)); /* Testing elements * Expected: Elements: 1 2 3 4 5 6 7 8 9 */ - java.lang.System.out.print("Elements: "); - q6.elements.foreach(e => java.lang.System.out.print(" "+ e + " ")); - java.lang.System.out.println(); + Console.print("Elements: "); + q6.elements.foreach(e => Console.print(" "+ e + " ")); + Console.println; /* Testing mkString * Expected: String: <1-2-3-4-5-6-7-8-9> */ - java.lang.System.out.println("String: " + q6.mkString("<","-",">")); + Console.println("String: " + q6.mkString("<","-",">")); /* Testing length * Expected: Length: 9 */ - java.lang.System.out.println("Length: " + q6.length); + Console.println("Length: " + q6.length); /* Testing front * Expected: Front: 1 */ - java.lang.System.out.println("Front: " + q6.front); + Console.println("Front: " + q6.front); } } diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index 41965ba5b1..dde11048d9 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -5,8 +5,6 @@ //############################################################################ -import java.lang.System; // to avoid name clash with .NET's library - object Test { def check_range: Int = { @@ -39,20 +37,20 @@ object Test { } def check_success[A](name: String, closure: => A, expected: A): Unit = { - System.out.print("test " + name); + Console.print("test " + name); try { val actual: A = closure; if (actual == expected) - System.out.print(" was successful"); + Console.print(" was successful"); else - System.out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } catch { case exception: Throwable => { - System.out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - System.out.println(); + Console.println; } def main(args: Array[String]): Unit = { @@ -60,7 +58,7 @@ object Test { check_success("check_take", check_take, 10); check_success("check_drop", check_drop, 12); check_success("check_foreach", check_foreach, 190); - System.out.println(); + Console.println; } } diff --git a/test/files/run/lists.scala b/test/files/run/lists.scala index 8911e83b26..3791828a1c 100644 --- a/test/files/run/lists.scala +++ b/test/files/run/lists.scala @@ -5,8 +5,6 @@ //############################################################################ -import java.lang.System; // to avoid name clash with .NET's library - object Test { val xs1 = List(1, 2, 3); @@ -82,20 +80,20 @@ object Test { } def check_success[A](name: String, closure: => A, expected: A): Unit = { - System.out.print("test " + name); + Console.print("test " + name); try { val actual: A = closure; if (actual == expected) - System.out.print(" was successful"); + Console.print(" was successful"); else - System.out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } catch { case exception: Throwable => { - System.out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - System.out.println(); + Console.println; } def main(args: Array[String]): Unit = { @@ -110,7 +108,7 @@ object Test { check_success("check_union", check_union, 10); check_success("check_zip", check_zip, 4); check_success("check_zipAll", check_zipAll, 6); - System.out.println(); + Console.println; } } diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala index 5a0c2e5c53..15dbe0c8c0 100644 --- a/test/files/run/literals.scala +++ b/test/files/run/literals.scala @@ -6,7 +6,6 @@ //############################################################################ object Test { - import java.lang.System.out; /* I add a couple of Unicode identifier tests here temporarily */ @@ -16,20 +15,20 @@ object Test { def \u21a1\u21a1( that:GGG ) = that; } def check_success[a](name: String, closure: => a, expected: a): Unit = { - out.print("test " + name); + Console.print("test " + name); try { val actual: a = closure; if (actual == expected) { - out.print(" was successful"); + Console.print(" was successful"); } else { - out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } } catch { case exception: Throwable => { - out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - out.println(); + Console.println; } def main(args: Array[String]) = { @@ -38,7 +37,7 @@ object Test { check_success("'\\u005f' == '_'", '\u005f', '_'); check_success("65.asInstanceOf[char] == 'A'", 65.asInstanceOf[char], 'A'); - out.println(); + Console.println; // int check_success("01 == 1", 01, 1); @@ -71,7 +70,7 @@ object Test { check_success("0x80000000 == -2147483648", 0x80000000, -2147483648); check_success("0xffffffff == -1", 0xffffffff, -1); - out.println(); + Console.println; // long check_success("1l == 1L", 1l, 1L); @@ -92,7 +91,7 @@ object Test { check_success("0xffffffffffffffffL == -1L", 0xffffffffffffffffL, -1L); - out.println(); + Console.println; // see JLS at address: // http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#230798 @@ -108,7 +107,7 @@ object Test { check_success("1.asInstanceOf[float] == 1.0", 1.asInstanceOf[float], 1.0f); check_success("1l.asInstanceOf[float] == 1.0", 1l.asInstanceOf[float], 1.0f); - out.println(); + Console.println; // double check_success("1e1 == 10.0", 1e1, 10.0); @@ -123,7 +122,7 @@ object Test { check_success("1.asInstanceOf[double] == 1.0", 1.asInstanceOf[double], 1.0); check_success("1l.asInstanceOf[double] == 1.0", 1l.asInstanceOf[double], 1.0); - out.println(); + Console.println; check_success("\"\\u001a\".length()", "\u001a".length(), 1); val ggg = GGG( 1 ) \u21a1\u21a1 GGG( 2 ); check_success("ggg == GGG( 2 )", ggg, GGG( 2 )); diff --git a/test/files/run/overloads.scala b/test/files/run/overloads.scala index a94f379888..31664b2ea6 100644 --- a/test/files/run/overloads.scala +++ b/test/files/run/overloads.scala @@ -3,8 +3,6 @@ //############################################################################ // $Id$ -import java.lang.System; // to avoid name clash with .NET's library - //############################################################################ object Ops { @@ -38,13 +36,13 @@ object overloads { def check(what: String, actual: Any, expected: Any): Unit = { val success: Boolean = actual == expected; - System.out.print(if (success) "ok" else "KO"); + Console.print(if (success) "ok" else "KO"); var value: String = if (actual == null) "null" else actual.toString(); if (value == "\u0000") value = "\\u0000"; - System.out.print(": " + what + " = " + value); - if (!success) System.out.print(" != " + expected); - System.out.println(); - System.out.flush(); + Console.print(": " + what + " = " + value); + if (!success) Console.print(" != " + expected); + Console.println; + Console.flush; } def - = 0; diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala index d849941f7c..ba4c199584 100644 --- a/test/files/run/tailcalls.scala +++ b/test/files/run/tailcalls.scala @@ -188,23 +188,21 @@ class TailCall[S](s: S) { // Test code object Test { - import java.lang.System.out; - def check_success(name: String, closure: => Int, expected: Int): Unit = { - out.print("test " + name); + Console.print("test " + name); try { val actual: Int = closure; if (actual == expected) { - out.print(" was successful"); + Console.print(" was successful"); } else { - out.print(" failed: expected "+ expected +", found "+ actual); + Console.print(" failed: expected "+ expected +", found "+ actual); } } catch { case exception: Throwable => { - out.print(" raised exception " + exception); + Console.print(" raised exception " + exception); } } - out.println(); + Console.println; } def calibrate: Int = { @@ -214,7 +212,8 @@ object Test { while (!stop) { try { calibrator.f(n, n); - if (n >= Integer.MAX_VALUE / 2) throw new Error("calibration failure"); + //if (n >= Integer.MAX_VALUE / 2) error("calibration failure"); + if (n >= scala.runtime.compat.Platform.MAX_INT / 2) error("calibration failure"); n = 2 * n; } catch { case exception: StackOverflowError => stop = true @@ -240,7 +239,7 @@ object Test { check_success("SubClass .f", SubClass .f(max, max), max); check_success("Sealed .f", Sealed .f(max, max), 0); check_success("SubSealed.f", SubSealed.f(max, max), max); - out.println(); + Console.println; // test tail calls in nested classes/objects val c: C = new C; @@ -274,7 +273,7 @@ object Test { check_success("c.c.O.c.f", c.c.O.c.f(max, max), 0); check_success("c.c.c.O.f", c.c.c.O.f(max, max), 0); check_success("c.c.c.c.f", c.c.c.c.f(max, max), 0); - out.println(); + Console.println; // test tail calls with different signatures val TailCall = new TailCall("S"); @@ -285,7 +284,7 @@ object Test { check_success("TailCall.g2", TailCall.g2(max, max ), 0); check_success("TailCall.g3", TailCall.g3(max, max, Nil), 0); check_success("TailCall.h1", TailCall.h1(max, max ), 0); - out.println(); + Console.println; } } |