pre_testing1/collatz_test.sh
changeset 356 d1046d9d3213
parent 352 97bcf8efe4e0
child 360 e45d2890749d
equal deleted inserted replaced
355:bc3980949af2 356:d1046d9d3213
     5 
     5 
     6 
     6 
     7 out=${1:-output}
     7 out=${1:-output}
     8 
     8 
     9 echo -e "" > $out
     9 echo -e "" > $out
       
    10 echo -e "" > c$out
    10 
    11 
    11 echo -e "Below is the feedback for your submission collatz.scala" >> $out
    12 echo -e "Below is the feedback for your submission collatz.scala" >> $out
    12 echo -e "" >> $out
    13 echo -e "" >> $out
    13 
    14 
    14 
    15 
    15 # compilation tests
    16 # compilation tests
    16 
    17 
    17 function scala_compile {
    18 function scala_compile {
    18   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
    19   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2>> $out 1>> $out)
    19 }
    20 }
    20 
    21 
    21 # functional tests
    22 # functional tests
    22 
    23 
    23 function scala_assert {
    24 function scala_assert {
    46 
    47 
    47 
    48 
    48 
    49 
    49 # var, .par return, ListBuffer test
    50 # var, .par return, ListBuffer test
    50 #
    51 #
    51 echo -e "collatz.scala does not contain VARS, RETURNS etc?" >> $out
       
    52 
    52 
    53 if  [ $tsts -eq 0 ]
    53 if  [ $tsts -eq 0 ]
    54 then 
    54 then
       
    55    echo -e "collatz.scala does not contain VARS, RETURNS etc?" >> $out
       
    56     
    55    if (scala_vars collatz.scala)
    57    if (scala_vars collatz.scala)
    56    then
    58    then
    57       echo -e "  --> FAIL (make triple-sure your program conforms to the required format)\n" >> $out
    59       echo -e "  --> FAIL (make triple-sure your program conforms to the required format)\n" >> $out
    58       tsts=$(( 1 ))
    60       tsts=$(( 1 ))
    59    else
    61    else