marking4/postfix_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Tue, 07 Dec 2021 23:17:51 +0000
changeset 418 fa7f7144f2bb
parent 329 8a34b2ebc8cc
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
set -euo pipefail
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
out=${1:-output}
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
echo -e "" > $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    10
echo -e "Below is the feedback and provisional marks for your submission" >> $out
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    11
echo -e "of Preliminar 9.  Please note all marks are provisional until" >> $out
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    12
echo -e "ratified by the assessment board -- this is not an official" >> $out
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    13
echo -e "results transcript." >> $out
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    14
echo -e "" >> $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    16
# marks for CW9 preliminary
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
marks=$(( 0 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
# compilation tests
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
function scala_compile {
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    23
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out)   
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
}
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
# functional tests
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
function scala_assert {
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    29
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) 
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
}
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
# purity test
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
function scala_vars {
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    35
#   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    36
    (egrep '\bvar\b|\breturn\b|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
}
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    40
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
# var, return, ListBuffer test
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
#
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
echo -e "postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
if (scala_vars postfix.scala)
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
then
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
    47
  echo -e "  --> FAIL\n" | tee -a $out  
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  tsts0=$(( 1 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    50
  echo -e "  --> success" | tee -a $out  
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  tsts0=$(( 0 )) 
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
# compilation test
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
if  [ $tsts0 -eq 0 ]
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
then    
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    57
  echo -e "postfix.scala runs?" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
258
ebe71908b13e updated
Christian Urban <urbanc@in.tum.de>
parents: 257
diff changeset
    59
  if (scala_compile postfix.scala)
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  then
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    61
    echo -e "  --> success" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
    tsts1=$(( 0 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    64
    echo -e "  --> SCALA DID NOT RUN postfix.scala" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
    tsts1=$(( 1 )) 
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
  fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
else
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  tsts1=$(( 1 ))     
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
### postfix tests
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
if [ $tsts1 -eq 0 ]
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  echo -e " syard(split(\"3 + 4 * ( 2 - 1 )\")) == List(\"3\", \"4\", \"2\", \"1\", \"-\", \"*\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
  echo -e " syard(split(\"( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )\")) == List(\"3\", \"4\", \"5\", \"+\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
  echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  if (scala_assert "postfix.scala" "postfix_test7.scala")
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
  then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
    echo -e "  --> success" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
    marks=$(( marks + 1 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
    86
    echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
if [ $tsts1 -eq 0 ]
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  echo -e " compute(syard(split(\"3 + 4 * ( 2 - 1 )\"))) == 7" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  echo -e " compute(syard(split(\"10 + 12 * 33\"))) == 406" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  echo -e " compute(syard(split(\"( 5 + 7 ) * 2\"))) == 24" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  echo -e " compute(syard(split(\"5 + 7 / 2\"))) == 8" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  if (scala_assert "postfix.scala" "postfix_test8.scala")
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
     echo -e "  --> success" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
     marks=$(( marks + 1 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  else
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   106
     echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
### postfix2 tests
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
# var, return, ListBuffer test
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
#
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
echo -e "postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
if (scala_vars postfix2.scala)
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
then
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   120
  echo -e "  --> FAIL\n" | tee -a $out  
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
  tsts0=$(( 1 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   123
  echo -e "  --> success" | tee -a $out  
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  tsts0=$(( 0 )) 
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
# compilation test
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
if  [ $tsts0 -eq 0 ]
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
then    
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   132
  echo -e "postfix2.scala runs?" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
258
ebe71908b13e updated
Christian Urban <urbanc@in.tum.de>
parents: 257
diff changeset
   134
  if (scala_compile postfix2.scala)
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
  then
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   136
    echo -e "  --> success" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
    tsts1=$(( 0 ))
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   139
    echo -e "  --> SCALA DID NOT RUN postfix2.scala" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
    tsts1=$(( 1 )) 
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
  fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
else
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  tsts1=$(( 1 ))     
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
if [ $tsts1 -eq 0 ]
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
  echo -e " syard(split(\"3 + 4 * ( 2 - 1 )\")) == List(\"3\", \"4\", \"2\", \"1\", \"-\", \"*\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  echo -e " syard(split(\"( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )\")) == List(\"3\", \"4\", \"5\", \"+\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
  echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  echo -e " syard(split(\"3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3\")) == " | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
  echo -e "         List(\"3\", \"4\", \"8\", \"*\", \"5\", \"1\", \"-\", \"2\", \"3\", \"^\", \"^\", \"/\", \"+\")" | tee -a $out
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   155
  
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   156
  if (scala_assert "postfix2.scala" "postfix_test9.scala")
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   157
  then
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   158
      echo -e "  --> success" | tee -a $out
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   159
      marks=$(( marks + 1 ))
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   160
  else
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   161
      echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   162
  fi
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   163
fi
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   164
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   165
if [ $tsts1 -eq 0 ]
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   166
then
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
  echo -e " compute(syard(split(\"3 + 4 * ( 2 - 1 )\"))) == 7" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
  echo -e " compute(syard(split(\"10 + 12 * 33\"))) == 406" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
  echo -e " compute(syard(split(\"( 5 + 7 ) * 2\"))) == 24" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
  echo -e " compute(syard(split(\"5 + 7 / 2\"))) == 8" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
  echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
  echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
  echo -e " compute(syard(split(\"4 ^ 3 ^ 2\"))) == 262144" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
  echo -e " compute(syard(split(\"4 ^ ( 3 ^ 2 )\"))) == 262144" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
  echo -e " compute(syard(split(\"( 4 ^ 3 ) ^ 2\"))) == 4096" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
  echo -e " compute(syard(split(\"( 3 + 1 ) ^ 2 ^ 3\"))) == 65536" | tee -a $out
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   178
  if (scala_assert "postfix2.scala" "postfix_test10.scala")
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  then
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
      echo -e "  --> success" | tee -a $out
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 288
diff changeset
   181
      marks=$(( marks + 1 ))
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  else
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   183
      echo -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
257
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
  fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
fi
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
ba4d976ca88d updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
## final marks
288
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   188
echo -e "Overall mark for CW 9, Preliminary Part" | tee -a $out
65731df141a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 258
diff changeset
   189
echo -e "$marks" | tee -a $out