diff -r 40657f9a4e4a -r 663c2a9108d1 pre_testing1/collatz_test.sh --- a/pre_testing1/collatz_test.sh Sat Oct 31 16:47:46 2020 +0000 +++ b/pre_testing1/collatz_test.sh Sun Nov 01 01:21:31 2020 +0000 @@ -15,7 +15,7 @@ # compilation tests function scala_compile { - (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) + (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out) } # functional tests @@ -27,41 +27,41 @@ # purity test function scala_vars { - (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|collection.mutable|util.control|new Array' "$1" 2> /dev/null 1> /dev/null) + (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null) } +### compilation test + +echo -e "collatz.scala runs?" >> $out + +if (scala_compile collatz.scala) +then + echo -e " --> success" >> $out + tsts=$(( 0 )) +else + echo -e " --> SCALA DID NOT RUN collatz.scala\n" >> $out + tsts=$(( 1 )) +fi + + + # var, .par return, ListBuffer test # -echo -e "collatz.scala does not contain vars, returns etc?" >> $out - -if (scala_vars collatz.scala) -then - echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" >> $out - tsts0=$(( 0 )) -else - echo -e " --> success" >> $out - tsts0=$(( 0 )) -fi - -### compilation test - +echo -e "collatz.scala does not contain VARS, RETURNS etc?" >> $out -if [ $tsts0 -eq 0 ] +if [ $tsts -eq 0 ] then - echo -e "collatz.scala runs?" >> $out + if (scala_vars collatz.scala) + then + echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" >> $out + tsts=$(( 1 )) + else + echo -e " --> success" >> $out + tsts=$(( 0 )) + fi +fi - if (scala_compile collatz.scala) - then - echo -e " --> success" >> $out - tsts=$(( 0 )) - else - echo -e " --> SCALA DID NOT RUN COLLATZ.SCALA\n" >> $out - tsts=$(( 1 )) - fi -else - tsts=$(( 1 )) -fi ### collatz tests