| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Sun, 19 Oct 2025 09:44:04 +0200 | |
| changeset 1010 | adc61c55e165 | 
| parent 977 | 7a02c5b9e0df | 
| permissions | -rw-r--r-- | 
| 977 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 1 | // for testing compilation | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 2 | import scala.util.{Try, Success, Failure}
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 3 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 4 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 5 | val res = {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 6 | if (os.exists(os.pwd / "br.class")) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 7 |     os.proc("java", "br").call(cwd = os.pwd)
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 8 | else if (os.exists(os.pwd / "br" / "br.class")) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 9 |     os.proc("java", "br.br").call(cwd = os.pwd)
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 10 |   else throw new Exception("No CLASS file found")
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 11 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 12 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 13 | if (res.exitCode != 0) {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 14 |   throw new Exception("Unsuccessful call")
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 15 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 16 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 17 | Try(res.out.text().replace("\n", "") == "23467") match {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 18 |   case Success(v) => Console.println(s"   Success. Printed ${res.out.text().replace("\n", "")}.")
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 19 |   case Failure(e) => Console.println(s"   Fail. Printed ${res.out.text()} instead of \"2,3,4,6,7\"\n") ; throw(e)
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 20 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 21 |