main_testing3/re_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 23 Dec 2022 16:52:34 +0000
changeset 456 d076cb2e0b75
parent 455 557d18cce0f0
child 463 0315d9983cd0
permissions -rwxr-xr-x
updated jars
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     2
set -euo pipefail
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     3
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
out=${1:-output}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
     7
echo -e "" > $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
     9
echo -e "Below is the feedback for your submission of re.scala." >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    10
echo -e "" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
# compilation tests
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
function scala_compile {
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    16
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
# functional tests
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
function scala_assert {
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    22
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
# purity test
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
function scala_vars {
426
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    28
    (sed 's/immutable/ok/g' c$out > cb$out;
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    29
     egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
# compilation test
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    35
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    36
echo -e "re.scala runs?" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    38
if (scala_compile re.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    39
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    40
    echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    41
    tsts=$(( 0 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    42
else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    43
    echo -e "  --> SCALA DID NOT RUN RE.SCALA\n" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    44
    tsts=$(( 1 )) 
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    47
# var, return, ListBuffer test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    48
#
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    49
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    50
if [ $tsts -eq 0 ]
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    51
then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    52
    echo -e "re.scala does not contain vars, returns etc?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    53
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    54
    if (scala_vars re.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    55
    then
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
    56
	echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out 
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    57
	tsts=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    58
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    59
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    60
	tsts=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    61
    fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    62
fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    63
426
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    64
### make sure datatypes are not tampered with
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    65
426
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    66
if [ $tsts -eq 0 ]
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    67
then
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    68
    echo -e "re.scala has case classes for ALTs and SEQs?" >> $out
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    69
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    70
    if (scala_assert "re.scala" "re_test0.scala")
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    71
    then
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    72
	echo -e "  --> passed" >> $out
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    73
	tsts=$(( 0 ))
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    74
    else	
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    75
	echo -e "  --> FAIL (make sure the case clases are as given in the template)" >> $out 
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    76
	tsts=$(( 1 ))
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    77
    fi
b51467741af2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 424
diff changeset
    78
fi
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    79
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    80
### re tests
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    82
if [ $tsts -eq 0 ]
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    84
  echo -e " nullable(ZERO) == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    85
  echo -e " nullable(ONE) == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    86
  echo -e " nullable(CHAR('a')) == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    87
  echo -e " nullable(ZERO | ONE) == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    88
  echo -e " nullable(ZERO | CHAR('a')) == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    89
  echo -e " nullable(ONE ~  ONE) == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    90
  echo -e " nullable(ONE ~ CHAR('a')) == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    91
  echo -e " nullable(STAR(ZERO)) == true" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
    92
  echo -e " nullable(ALTs(List(ONE, CHAR('a'), ZERO))) == true" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
    93
  echo -e " nullable(SEQs(List(ONE, ALTs(List(ONE, CHAR('a'), ZERO)), STAR(ZERO)))) == true" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    95
  if (scala_assert "re.scala" "re_test1.scala")
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    97
    echo -e "  --> success" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
    99
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   104
if [ $tsts -eq 0 ]
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   106
  echo -e " der('a', ZERO | ONE) == (ZERO | ZERO)" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   107
  echo -e " der('a', (CHAR('a') | ONE) ~ CHAR('a')) ==" >> $out
453
08cd972b219f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 445
diff changeset
   108
  echo -e "                 ALT((ONE | ZERO) ~ CHAR('a'), SEQs(List(ONE)))" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   109
  echo -e " der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')" >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   110
  echo -e " der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   111
  echo -e " der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
  
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   113
  if (scala_assert "re.scala" "re_test2.scala")
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
  then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   115
    echo -e "  --> success" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
  else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   117
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
  fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   122
if [ $tsts -eq 0 ]
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   124
  echo -e " simp(ZERO | ONE) == ONE" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   125
  echo -e " simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE)" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   126
  echo -e " simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')" >> $out
424
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   127
  echo -e " simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a')" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   128
  echo -e " simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a')" >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   129
  echo -e " simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   130
  echo -e " simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   131
  echo -e " simp(CHAR('a') | CHAR('a')) == CHAR('a')" >> $out
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 315
diff changeset
   132
  echo -e " simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a')" >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   133
  echo -e " simp(ONE | CHAR('a')) == (ONE | CHAR('a'))" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   134
  echo -e " simp(ALT((CHAR('a') | ZERO) ~ ONE," >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   135
  echo -e "          ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a')" >> $out
315
7ea440e1ffbb updated
Christian Urban <urbanc@in.tum.de>
parents: 300
diff changeset
   136
  echo -e " simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO" >> $out
7ea440e1ffbb updated
Christian Urban <urbanc@in.tum.de>
parents: 300
diff changeset
   137
  echo -e " simp(ALT(ONE | ONE, ONE | ONE)) == ONE" >> $out
7ea440e1ffbb updated
Christian Urban <urbanc@in.tum.de>
parents: 300
diff changeset
   138
  echo -e " simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a')" >> $out
403
ffce7b61b446 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   139
  echo -e " simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE, CHAR('a'))" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   140
  echo -e " simp(ALTs(Nil)) == ZERO" >> $out
455
557d18cce0f0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 453
diff changeset
   141
  echo -e " simp(SEQs(List(CHAR('a')))) == CHAR('a')" >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   142
  if (scala_assert "re.scala" "re_test3.scala")
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   144
    echo -e "  --> success" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
  else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   146
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   151
if [ $tsts -eq 0 ]
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
then
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   153
    echo -e " denest(List(ONE, ZERO, ALTs(List(ONE, CHAR('a'))))) == List(ONE, ONE, CHAR('a'))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   154
    echo -e " denest(List(ONE ~ ONE, ZERO, ZERO | ONE)) == List(ONE ~ ONE, ZERO, ONE)" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   155
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   156
  if (scala_assert "re.scala" "re_test4.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   157
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   158
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   159
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   160
    echo -e "  --> \n ONE TEST FAILED\n" >> $out   
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   161
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   162
fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   163
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   164
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   165
if [ $tsts -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   166
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   167
    echo -e " flts(List(CHAR('a'), ZERO, ONE), Nil) == List(ZERO)" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   168
    echo -e " flts(List(CHAR('a'), ONE, ONE, CHAR('b')), Nil) == List(CHAR('a'), CHAR('b'))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   169
    echo -e " flts(List(ONE ~ CHAR('a'), CHAR('b') ~ ONE), Nil) == List(ONE, CHAR('a'), CHAR('b'), ONE)" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   170
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   171
  if (scala_assert "re.scala" "re_test5.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   172
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   173
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   174
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   175
    echo -e "  --> \n ONE TEST FAILED\n" >> $out   
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   176
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   177
fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   178
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   179
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   180
if [ $tsts -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   181
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   182
    echo -e " SEQs_smart(Nil) == ONE" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   183
    echo -e " SEQs_smart(List(ZERO)) == ZERO" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   184
    echo -e " SEQs_smart(List(CHAR('a'))) == CHAR('a')" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   185
    echo -e " SEQs_smart(List(ONE ~ ONE)) == ONE ~ ONE" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   186
    echo -e " SEQs_smart(List(ONE, ONE)) == SEQs(List(ONE, ONE))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   187
    echo -e " ALTs_smart(Nil) == ZERO" >> $out
456
d076cb2e0b75 updated jars
Christian Urban <christian.urban@kcl.ac.uk>
parents: 455
diff changeset
   188
    echo -e " ALTs_smart(List(ONE ~ ONE)) == ONE ~ ONE" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   189
    echo -e " ALTs_smart(List(ZERO, ZERO)) == ALTs(List(ZERO, ZERO))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   190
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   191
  if (scala_assert "re.scala" "re_test6.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   192
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   193
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   194
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   195
    echo -e "  --> \n ONE TEST FAILED\n" >> $out   
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   196
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   197
fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   198
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   199
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   200
if [ $tsts -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   201
then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   202
  echo -e " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out
445
b73e7ce91c10 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
   203
  echo -e " ders(\"aaaaa\".toList, EVIL) == SEQs(List(STAR(CHAR('a')), STAR(STAR(CHAR('a'))), CHAR('b')))" >> $out
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   204
  echo -e " ders(List('b'), EVIL) == ONE" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   205
  echo -e " ders(\"bb\".toList, EVIL) == ZERO" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   206
  echo -e " matcher(EVIL, \"a\" * 5 ++ \"b\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   207
  echo -e " matcher(EVIL, \"b\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   208
  echo -e " matcher(EVIL, \"bb\") == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   209
  echo -e " matcher(\"abc\", \"abc\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   210
  echo -e " matcher((\"ab\" | \"a\") ~ (ONE | \"bc\"), \"abc\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   211
  echo -e " matcher(ONE, \"\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   212
  echo -e " matcher(ZERO, \"\") == false" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   213
  echo -e " matcher(ONE | CHAR('a'), \"\") == true" >> $out
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   214
  echo -e " matcher(ONE | CHAR('a'), \"a\") == true" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
  
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   216
  if (scala_assert "re.scala" "re_test7.scala")
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
  then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   218
    echo -e "  --> success" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
  else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   220
    echo -e "  --> \n ONE TEST FAILED\n" >> $out  
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
  fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   225
if [ $tsts -eq 0 ]
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   227
  echo -e " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out  
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   228
  echo -e " size(der('a', der('a', EVIL))) == 36" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   229
  echo -e " size(der('a', der('a', der('a', EVIL)))) == 83" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   230
  echo -e " size(ders(\"aaaaaa\".toList, EVIL)) == 7" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   231
  echo -e " size(ders((\"a\" * 50).toList, EVIL)) == 7" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
  
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 426
diff changeset
   233
  if (scala_assert "re.scala" "re_test8.scala")
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
  then
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   235
    echo -e "  --> success" >> $out
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
  else
221
9e7897f25e13 updated
Christian Urban <urbanc@in.tum.de>
parents: 215
diff changeset
   237
    echo -e "  --> \n ONE TEST FAILED\n" >> $out   
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
  fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
fi
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241