diff options
author | paltherr <paltherr@epfl.ch> | 2004-01-08 18:52:27 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-01-08 18:52:27 +0000 |
commit | e3a34d5bee27b29ad794c4d739357ffc6c9792c8 (patch) | |
tree | ad7a3aebb92cf189260c68e9021ed43f472536dc /test/files | |
parent | d9eef6e14426c8bb0af852b066f3fe1830dc6d3c (diff) | |
download | scala-e3a34d5bee27b29ad794c4d739357ffc6c9792c8.tar.gz scala-e3a34d5bee27b29ad794c4d739357ffc6c9792c8.tar.bz2 scala-e3a34d5bee27b29ad794c4d739357ffc6c9792c8.zip |
- Added files/run/runtime
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/runtime.check | 16 | ||||
-rw-r--r-- | test/files/run/runtime.scala | 84 |
2 files changed, 100 insertions, 0 deletions
diff --git a/test/files/run/runtime.check b/test/files/run/runtime.check new file mode 100644 index 0000000000..e5597432b7 --- /dev/null +++ b/test/files/run/runtime.check @@ -0,0 +1,16 @@ +<<< bug Test0 +hello +[] +[false,true] +[0,1,2] +[3,4,5] +[a,b,c] +[6,7,8] +[9,10,11] +[12.0,13.0] +[14.0,15.0] +[6,7,8.0,9.0] +[string] +[0,bye] +>>> bug Test0 + diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala new file mode 100644 index 0000000000..475bb9c60e --- /dev/null +++ b/test/files/run/runtime.scala @@ -0,0 +1,84 @@ +//############################################################################ +// Run Time Bugs & Test Cases +//############################################################################ +// $Id$ + +import java.lang.System; // to avoid name clash with .NET's library + +//############################################################################ +// Test 0 - Array creation + +object Test0Test { + def println[A](xs: Array[A]): Unit = { + var i = 0; + System.out.print("["); + while (i < xs.length) { + if (i > 0) System.out.print(","); + System.out.print(xs(i)); + i = i + 1; + } + System.out.print("]"); + System.out.println(); + } + + def main(args: Array[String]): Unit = { + val zs: Array[Boolean] = Array(false, true); + val bs: Array[Byte ] = Array(0, 1, 2); + val ss: Array[Short ] = Array(3, 4, 5); + val cs: Array[Char ] = Array('a', 'b', 'c'); + val is: Array[Int ] = Array(6, 7, 8); + val ls: Array[Long ] = Array(9l, 10l, 11l); + val fs: Array[Float ] = Array(12.0f, 13.0f); + val ds: Array[Double ] = Array(14.0d, 15.0d); + val vs: Array[AnyVal ] = Array(6, 7l, 8f, 9d); + val os: Array[AnyRef ] = Array("string"); + val as: Array[Any ] = Array(0, "bye"); + println({ System.out.println("hello"); Predef}.Array()); + println(zs); + println(bs); + println(ss); + println(cs); + println(is); + println(ls); + println(fs); + println(ds); + println(vs); + println(os); + println(as); + } +} + +//############################################################################ +// Main + +object Test { + var errors: Int = 0; + def test(bug: String, def test: Unit): Unit = { + System.out.println("<<< bug " + bug); + try { + test; + } catch { + case exception => { + val name: String = Thread.currentThread().getName(); + System.out.print("Exception in thread \"" + name + "\" "); + exception.printStackTrace(); + System.out.println(); + errors = errors + 1; + } + } + System.out.println(">>> bug " + bug); + System.out.println(); + } + + def main(args: Array[String]): Unit = { + + test("Test0" , Test0Test.main(args)); + + if (errors > 0) { + System.out.println(); + System.out.println(errors + " error" + (if (errors > 1) "s" else "")); + } + } +} + +//############################################################################ |