| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Fri, 17 Oct 2025 11:20:49 +0100 | |
| changeset 1009 | 7fd1997bd14c | 
| parent 977 | 7a02c5b9e0df | 
| permissions | -rwxr-xr-x | 
| 977 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 1 | #!/bin/zsh | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 2 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 3 | # to make the script fail safely | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 4 | set -euo pipefail | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 5 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 6 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 7 | out=${1:-output}
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 8 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 9 | echo -e "" > $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 10 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 11 | echo `date` | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 12 | echo "" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 13 | echo "Below is the feedback and provisional marks for your CW 5 submission." >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 14 | echo "Please note all marks are provisional until ratified by the" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 15 | echo "assessment board -- this is not an official results transcript." >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 16 | echo "" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 17 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 18 | echo "The feedback for your submission for cw05.sc" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 19 | echo "" >> $out | 
| 
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 | # marks for CW 5 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 22 | marks=$(( 0.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 23 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 24 | # compilation tests | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 25 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 26 | function scala_compile {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 27 | (ulimit -t 30; JAVA_OPTS="-Xmx1g" amm -s "$1" 2> c$out 1> c$out) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 28 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 29 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 30 | # functional tests | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 31 | setopt no_nomatch | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 32 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 33 | function scala_assert {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 34 | rm -rf /Users/cu/.ammonite/cache/3.0.0-M2/* 1> /dev/null 2> /dev/null ; | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 35 | (ulimit -t 300; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 36 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 37 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 38 | function scala_fail {
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 39 | rm -rf /Users/cu/.ammonite/cache/3.0.0-M2/* 1> /dev/null 2> /dev/null ; | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 40 | (ulimit -t 300; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" | tee -a $out) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 41 | } | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 42 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 43 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 44 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 45 | ### compilation test | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 46 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 47 | echo -e "0) cw05.sc compiles?" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 48 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 49 | if (scala_compile "c.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 50 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 51 | echo -e " --> yes cw05.sc compiles\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 52 | tsts=$(( 0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 53 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 54 | echo -e " --> AMM DID NOT compile cw05.sc\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 55 | cat c$out | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 56 | tsts=$(( 1 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 57 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 58 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 59 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 60 | ### tokenise test | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 61 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 62 | if [ $tsts -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 63 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 64 | echo -e "1) tokenise test\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 65 | cat cw05.sc c1_add.sc > cw05_add.sc | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 66 | if (scala_assert "c1.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 67 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 68 | echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 69 | #cat $out | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 70 | marks=$(( marks + 2.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 71 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 72 | echo -e " --> FAILED\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 73 | cat $out | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 74 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 75 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 76 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 77 | ### parsing test | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 78 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 79 | if [ $tsts -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 80 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 81 | echo -e "2) parsing test\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 82 | cat cw05.sc c2_add.sc > cw05_add.sc | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 83 | START=$(date +%s) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 84 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 85 | if (scala_assert "c2.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 86 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 87 | END=$(date +%s) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 88 | DIFF=$(( $END - $START )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 89 | echo -e " This test ran for $DIFF seconds" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 90 | echo -e " --> success (+ 3.0 Marks)\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 91 | #cat $out | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 92 | marks=$(( marks + 3.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 93 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 94 | END=$(date +%s) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 95 | DIFF=$(( $END - $START )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 96 | echo -e " This test ran for $DIFF seconds" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 97 | echo -e " --> FAILED\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 98 | cat $out | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 99 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 100 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 101 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 102 | ### mand test | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 103 | echo >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 104 | #echo -e "\n\n\n" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 105 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 106 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 107 | tstsB=$(( 1 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 108 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 109 | if [ $tsts -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 110 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 111 | echo -e "3.1) Generating ll-file for mand.fun:\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 112 | echo >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 113 | cat cw05.sc c3_add.sc > cw051_add.sc | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 114 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 115 | if (scala_assert "c3.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 116 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 117 | echo -e " --> success" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 118 | tstsB=$(( 0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 119 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 120 | echo -e " --> FAIL\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 121 | cat c$out >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 122 | tail -25 $out | pr -to10 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 123 | tstsB=$(( 1 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 124 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 125 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 126 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 127 | if [ $tstsB -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 128 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 129 | echo -e "3.2) Running mand.ll and check its output" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 130 | if (scala_fail "c4.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 131 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 132 | echo -e " --> success (+ 12.0 Marks)\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 133 | marks=$(( marks + 12.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 134 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 135 | echo -e " --> FAIL\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 136 | echo -e " generated:" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 137 | cat "mand.ll" | pr -to10 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 138 | #cat c$out >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 139 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 140 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 141 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 142 | ### mand test | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 143 | echo >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 144 | #echo -e "\n\n\n" >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 145 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 146 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 147 | if [ $tsts -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 148 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 149 | echo -e "4.1) Generating ll-file for sqr.fun:\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 150 | echo >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 151 | cat cw05.sc c3_add.sc > cw051_add.sc | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 152 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 153 | if (scala_assert "c5.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 154 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 155 | echo -e " --> success" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 156 | tstsB=$(( 0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 157 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 158 | echo -e " --> FAIL\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 159 | cat c$out >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 160 | tail -25 $out | pr -to10 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 161 | tstsB=$(( 1 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 162 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 163 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 164 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 165 | if [ $tstsB -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 166 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 167 | echo -e "4.2) Running sqr.ll and check its output" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 168 | if (scala_fail "c6.sc") | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 169 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 170 | echo -e " --> success (+ 6.0 Marks)\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 171 | marks=$(( marks + 6.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 172 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 173 | echo -e " --> FAIL\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 174 | echo -e " generated:" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 175 | cat "sqr.ll" | pr -to10 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 176 | #cat c$out >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 177 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 178 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 179 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 180 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 181 | if [ $tsts -eq 0 ] | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 182 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 183 |     echo -e "5) Does main return an integer in mand.ll (define i32 @main() {...})? " | tee -a $out
 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 184 | if (grep "define i32 @main()" "mand.ll" 1> /dev/null 2> /dev/null) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 185 | then | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 186 | echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 187 | marks=$(( marks + 2.0 )) | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 188 | else | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 189 | echo -e " --> FAIL\n" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 190 | #tail -25 $out | pr -to10 | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 191 | #cat c$out >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 192 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 193 | fi | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 194 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 195 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 196 | ## final marks | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 197 | echo >> $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 198 | echo "Overall mark for CW 5" | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 199 | printf " %0.2f\n" $marks | tee -a $out | 
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 200 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 201 | |
| 
7a02c5b9e0df
updated marking scripts
 Christian Urban <christian.urban@kcl.ac.uk> parents: diff
changeset | 202 |