equal
deleted
inserted
replaced
1 #!/bin/bash |
1 #!/bin/bash |
2 set -e |
2 set -euo pipefail |
3 |
3 |
4 out=${1:-output} |
4 scalafile=${1:-bfc.scala} |
|
5 out=${2:-output} |
|
6 |
5 |
7 |
6 echo -e "" > $out |
8 echo -e "" > $out |
7 |
9 |
8 echo -e "Below is the feedback for your submission of bfc.scala" >> $out |
10 echo -e "Below is the feedback for your submission of bfc.scala" >> $out |
9 echo -e "" >> $out |
11 echo -e "" >> $out |
30 |
32 |
31 |
33 |
32 # compilation test |
34 # compilation test |
33 echo -e "bfc.scala runs?" >> $out |
35 echo -e "bfc.scala runs?" >> $out |
34 |
36 |
35 if (scala_compile bfc.scala) |
37 if (scala_compile $scalafile) |
36 then |
38 then |
37 echo -e " --> passed" >> $out |
39 echo -e " --> passed" >> $out |
38 tsts1=$(( 0 )) |
40 tsts1=$(( 0 )) |
39 else |
41 else |
40 echo -e " --> SCALA DID NOT RUN BFC.SCALA\n" >> $out |
42 echo -e " --> SCALA DID NOT RUN BFC.SCALA\n" >> $out |
46 # |
48 # |
47 if [ $tsts1 -eq 0 ] |
49 if [ $tsts1 -eq 0 ] |
48 then |
50 then |
49 echo -e "bfc.scala does not contain vars, returns etc?" >> $out |
51 echo -e "bfc.scala does not contain vars, returns etc?" >> $out |
50 |
52 |
51 if (scala_vars bfc.scala) |
53 if (scala_vars $scalafile) |
52 then |
54 then |
53 echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out |
55 echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out |
54 tsts1=$(( 1 )) |
56 tsts1=$(( 1 )) |
55 else |
57 else |
56 echo -e " --> passed" >> $out |
58 echo -e " --> passed" >> $out |
63 if [ $tsts1 -eq 0 ] |
65 if [ $tsts1 -eq 0 ] |
64 then |
66 then |
65 echo -e " jtable(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]\"\"\") ==" >> $out |
67 echo -e " jtable(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]\"\"\") ==" >> $out |
66 echo -e " Map(69 -> 61, 5 -> 20, 60 -> 70, 27 -> 44, 43 -> 28, 19 -> 6)" >> $out |
68 echo -e " Map(69 -> 61, 5 -> 20, 60 -> 70, 27 -> 44, 43 -> 28, 19 -> 6)" >> $out |
67 |
69 |
68 if (scala_assert "bfc.scala" "bf_test5.scala") |
70 if (scala_assert $scalafile "bf_test5.scala") |
69 then |
71 then |
70 echo -e " --> success" >> $out |
72 echo -e " --> success" >> $out |
71 else |
73 else |
72 echo -e " --> \n ONE TEST FAILED\n" >> $out |
74 echo -e " --> \n ONE TEST FAILED\n" >> $out |
73 fi |
75 fi |
77 |
79 |
78 if [ $tsts1 -eq 0 ] |
80 if [ $tsts1 -eq 0 ] |
79 then |
81 then |
80 echo -e " optimise(load_bff(\"benchmark.bf\")).length == 181" >> $out |
82 echo -e " optimise(load_bff(\"benchmark.bf\")).length == 181" >> $out |
81 echo -e " optimise(load_bff(\"mandelbrot.bf\")).length == 11205" >> $out |
83 echo -e " optimise(load_bff(\"mandelbrot.bf\")).length == 11205" >> $out |
82 if (scala_assert "bfc.scala" "bf_test6.scala") |
84 if (scala_assert $scalafile "bf_test6.scala") |
83 then |
85 then |
84 echo -e " --> success" >> $out |
86 echo -e " --> success" >> $out |
85 else |
87 else |
86 echo -e " --> \n ONE TEST FAILED\n" >> $out |
88 echo -e " --> \n ONE TEST FAILED\n" >> $out |
87 fi |
89 fi |
92 if [ $tsts1 -eq 0 ] |
94 if [ $tsts1 -eq 0 ] |
93 then |
95 then |
94 echo -e " combine(optimise(load_bff(\"benchmark.bf\"))).length == 134" >> $out |
96 echo -e " combine(optimise(load_bff(\"benchmark.bf\"))).length == 134" >> $out |
95 echo -e " combine(optimise(load_bff(\"mandelbrot.bf\"))).length == 6511" >> $out |
97 echo -e " combine(optimise(load_bff(\"mandelbrot.bf\"))).length == 6511" >> $out |
96 |
98 |
97 if (scala_assert "bfc.scala" "bf_test7.scala") |
99 if (scala_assert $scalafile "bf_test7.scala") |
98 then |
100 then |
99 echo -e " --> success" >> $out |
101 echo -e " --> success" >> $out |
100 else |
102 else |
101 echo -e " --> \n ONE TEST FAILED\n" >> $out |
103 echo -e " --> \n ONE TEST FAILED\n" >> $out |
102 fi |
104 fi |