solutions/build.sh
changeset 921 bb54e7aa1a3f
equal deleted inserted replaced
920:7af2eea19646 921:bb54e7aa1a3f
       
     1 #!/usr/bin/env -S scala-cli shebang -no-indent
       
     2 //> using scala "3.3.1"
       
     3 //> using toolkit latest
       
     4 
       
     5 // course work directories
       
     6 val cws = List("cw1", "cw2", "cw3", "cw4", "cw5")
       
     7 
       
     8 // main files that need testing
       
     9 val files = Map("cw1" -> "cw1.sc", 
       
    10                 "cw2" -> "lexer.sc",
       
    11 		 		"cw3" -> "parser.sc",
       
    12 		 		"cw4" -> "compiler.sc",
       
    13 		 		"cw5" -> "fun_llvm.sc"
       
    14 		)
       
    15 
       
    16 // test files used as input
       
    17 val test_files = Map(
       
    18     "cw1" -> Nil,
       
    19     "cw2" -> List("collatz.while",
       
    20 		  "collatz2.while",
       
    21 		  "factors.while",
       
    22 		  "fib.while",
       
    23 		  "loops.while",
       
    24 		  "primes.while"),
       
    25     "cw3" -> List("collatz.while",
       
    26 		  "collatz2.while",
       
    27 		  "factors.while",
       
    28 		  "fib.while",
       
    29 		  "loops.while",
       
    30 		  "primes.while"),
       
    31     "cw4" -> List("collatz2.while",
       
    32 		  "fib.while",
       
    33 		  "forloop.while",
       
    34 		  "forloop2.while"),
       
    35     "cw5" -> List("fact.fun",
       
    36 		  	"hanoi.fun",
       
    37 		    "mand.fun",
       
    38 			"mand2.fun")
       
    39 )   
       
    40 
       
    41 
       
    42 for (cw <- cws) {
       
    43 	val main_file = files(cw)
       
    44 	for (arg <- test_files(cw)) {
       
    45 		println(s"Testing $cw/$main_file with $arg")
       
    46 		val subdir = os.pwd / cw
       
    47 		os.proc("amm", main_file, "test", arg).call(cwd = subdir)
       
    48 	}
       
    49 }