marking3/re_test.sh
author Christian Urban <urbanc@in.tum.de>
Tue, 16 Jan 2018 10:47:29 +0000
changeset 168 bb69fdebf05a
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
168
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
# to make the script fail safely
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
set -euo pipefail
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
out=${1:-output}
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
echo "" > $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
echo "Below is the feedback and provisional marks for your submission" >> $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
echo "for assignment 8 Part 1.  Please note all marks are provisional until" >> $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
echo "ratified by the assessment board -- this is not an official" >> $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
echo "results transcript." >> $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
echo "" >> $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
# marks for CW8 part 1
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
marks=$(( 0 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
# compilation tests
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
function scala_compile {
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
    (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null)
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
}
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
# functional tests
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
function scala_assert {
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
    (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
}
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
# purity test
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
function scala_vars {
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
}
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
# var, return, ListBuffer test
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
#
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
echo "re.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
if (scala_vars re.scala)
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  tsts0=$(( 1 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
  tsts0=$(( 0 )) 
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
# compilation test
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
if  [ $tsts0 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
then    
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  echo "re.scala runs?" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  if (scala_compile re.scala)
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
    echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
    tsts1=$(( 0 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
    echo "  --> scala re.scala did not run successfully" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
    tsts1=$(( 1 )) 
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
  tsts1=$(( 1 ))     
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
if [ $tsts1 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
  echo " nullable(ZERO) == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
  echo " nullable(ONE) == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  echo " nullable(CHAR('a')) == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
  echo " nullable(ZERO | ONE) == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
  echo " nullable(ZERO | CHAR('a')) == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  echo " nullable(ONE ~  ONE) == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  echo " nullable(ONE ~ CHAR('a')) == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  echo " nullable(STAR(ZERO)) == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
  
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  if (scala_assert "re.scala" "re1a_test.scala")
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
      echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
      marks=$(( marks + 1 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
      echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
if [ $tsts1 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  echo " der('a', ZERO | ONE) == (ZERO | ZERO)" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  echo " der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALT((ONE | ZERO) ~ CHAR('a'), ONE)" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  echo " der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  echo " der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  echo " der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  if (scala_assert "re.scala" "re1b_test.scala")
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
      echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
      marks=$(( marks + 1 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
      echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
if [ $tsts1 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
  echo " simp(ZERO | ONE) == ONE" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
  echo " simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE)" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
  echo " simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
  echo " simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
  echo " simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
  echo " simp(CHAR('a') | CHAR('a')) == CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
  echo " simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
  echo " simp(ONE | CHAR('a')) == (ONE | CHAR('a'))" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
  echo " simp(ALT((CHAR('a') | ZERO) ~ ONE," | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  echo "          ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  echo " simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
  echo " simp(ALT(ONE | ONE, ONE | ONE)) == ONE" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
  echo " simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a')" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
  echo " simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
  echo "    the Iterator produces the rexp" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
  echo "" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  echo "      SEQ(SEQ(SEQ(..., ONE | ONE) , ONE | ONE), ONE | ONE)" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
  echo "" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  echo "    where SEQ is nested 50 times." | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
  if (scala_assert "re.scala" "re1c_test.scala")
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
      echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
      marks=$(( marks + 2 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
      echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
if [ $tsts1 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
  echo " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  echo " ders((\"a\" * 5).toList,EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  echo " ders(List('b'),EVIL) == ONE" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
  echo " ders(List('b','b'),EVIL) == ZERO" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  echo " matcher(EVIL, \"a\" * 5 ++ \"b\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
  echo " matcher(EVIL, \"a\" * 50 ++ \"b\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  echo " matcher(EVIL, \"a\" * 50) == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  echo " matcher(EVIL, \"b\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
  echo " matcher(EVIL, \"bb\") == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
  echo " matcher(\"abc\", \"abc\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
  echo " matcher((\"ab\" | \"a\") ~ (ONE | \"bc\"), \"abc\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
  echo " matcher(ONE, \"\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
  echo " matcher(ZERO, \"\") == false" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  echo " matcher(ONE | CHAR('a'), \"\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
  echo " matcher(ONE | CHAR('a'), \"a\") == true" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
  
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
  if (scala_assert "re.scala" "re1d_test.scala")
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
      echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
      marks=$(( marks + 1 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
      echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
if [ $tsts1 -eq 0 ]
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
  echo " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" | tee -a $out  
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
  echo " size(der('a', der('a', EVIL))) == 28" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
  echo " size(der('a', der('a', der('a', EVIL)))) == 58" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  echo " size(ders(\"aaaaaa\".toList, EVIL)) == 8" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
  echo " size(ders((\"a\" * 50).toList, EVIL)) == 8" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
  if (scala_assert "re.scala" "re1e_test.scala")
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
  then
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
      echo "  --> success" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
      marks=$(( marks + 1 ))
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
  else
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
      echo "  --> test failed" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
  fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
fi
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
## final marks
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
echo "Overall mark for CW 8, Part 1" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
echo "$marks" | tee -a $out
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
bb69fdebf05a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194