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