diff -r c989f50da5de -r e461b5325b5e testing5/bf_test.sh --- a/testing5/bf_test.sh Thu Dec 06 18:56:26 2018 +0000 +++ b/testing5/bf_test.sh Thu Dec 06 21:49:43 2018 +0000 @@ -3,22 +3,22 @@ out=${1:-output} -echo "" > $out +echo -e "" > $out -echo "Below is the feedback for your submission of CW 8, Part 2." >> $out -echo "" >> $out +echo -e "Below is the feedback for your submission of CW 10, Part 1." >> $out +echo -e "" >> $out # compilation tests function scala_compile { - (ulimit -t 30 -m 1024000 ; scala "$1" 2>> $out 1>> $out) + (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) } # functional tests function scala_assert { - (ulimit -t 30 -m 1024000 ; scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) + (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) } # purity test @@ -30,14 +30,14 @@ # var, return, ListBuffer test # -echo "bf.scala does not contain vars, returns etc?" >> $out +echo -e "bf.scala does not contain vars, returns etc?" >> $out if (scala_vars bf.scala) then - echo " --> fail" >> $out - tsts0=$(( 1 )) + echo -e " --> fail (make triple-sure your program conforms to the required format)" >> $out + tsts0=$(( 0 )) else - echo " --> success" >> $out + echo -e " --> success" >> $out tsts0=$(( 0 )) fi @@ -45,14 +45,14 @@ # compilation test if [ $tsts0 -eq 0 ] then - echo "bf.scala runs?" >> $out + echo -e "bf.scala runs?" >> $out if (scala_compile bf.scala) then - echo " --> success" >> $out + echo -e " --> success" >> $out tsts1=$(( 0 )) else - echo " --> scala bf.scala did not run successfully" >> $out + echo -e " --> --> SCALA DID NOT RUN BF.SCALA\nx" >> $out tsts1=$(( 1 )) fi else @@ -60,19 +60,33 @@ fi +### bf tests if [ $tsts1 -eq 0 ] then - echo " sread(Map(), 2) == 0" >> $out - echo " sread(Map(2 -> 1), 2) == 1" >> $out - echo " write(Map(), 1, 2) == Map(1 -> 2)" >> $out - echo " write(Map(1 -> 0), 1, 2) == Map(1 -> 2)" >> $out + echo -e " load_bff(\"benchmark.bf\").length == 188" >> $out + echo -e " load_bff(\"foobar.bf\") == \"\"" >> $out - if (scala_assert "bf.scala" "bf1a_test.scala") + if (scala_assert "bf.scala" "bf_test1.scala") then - echo " --> success" >> $out + echo -e " --> success" >> $out else - echo " --> test failed" >> $out + echo -e " --> \n ONE TEST FAILED\n" >> $out + fi +fi + +if [ $tsts1 -eq 0 ] +then + echo -e " sread(Map(), 2) == 0" >> $out + echo -e " sread(Map(2 -> 1), 2) == 1" >> $out + echo -e " write(Map(), 1, 2) == Map(1 -> 2)" >> $out + echo -e " write(Map(1 -> 0), 1, 2) == Map(1 -> 2)" >> $out + + if (scala_assert "bf.scala" "bf_test2.scala") + then + echo -e " --> success" >> $out + else + echo -e " --> \n ONE TEST FAILED\n" >> $out fi fi @@ -80,20 +94,20 @@ if [ $tsts1 -eq 0 ] then - echo " jumpRight(\"[******]***\", 1, 0) == 8" >> $out - echo " jumpRight(\"[**[*]*]***\", 1, 0) == 8" >> $out - echo " jumpRight(\"[**[*]*]***\", 1, 0) == 8" >> $out - echo " jumpRight(\"[**[***]***\", 1, 0) == 11" >> $out - echo " jumpRight(\"[*[][]*]***\", 1, 0) == 8" >> $out - echo " jumpLeft(\"[******]***\", 6, 0) == 1" >> $out - echo " jumpLeft(\"[******]***\", 7, 0) == -1" >> $out - echo " jumpLeft(\"[*[][]*]***\", 6, 0) == 1" >> $out + echo -e " jumpRight(\"[******]***\", 1, 0) == 8" >> $out + echo -e " jumpRight(\"[**[*]*]***\", 1, 0) == 8" >> $out + echo -e " jumpRight(\"[**[*]*]***\", 1, 0) == 8" >> $out + echo -e " jumpRight(\"[**[***]***\", 1, 0) == 11" >> $out + echo -e " jumpRight(\"[*[][]*]***\", 1, 0) == 8" >> $out + echo -e " jumpLeft(\"[******]***\", 6, 0) == 1" >> $out + echo -e " jumpLeft(\"[******]***\", 7, 0) == -1" >> $out + echo -e " jumpLeft(\"[*[][]*]***\", 6, 0) == 1" >> $out - if (scala_assert "bf.scala" "bf1b_test.scala") + if (scala_assert "bf.scala" "bf_test3.scala") then - echo " --> success" >> $out + echo -e " --> success" >> $out else - echo " --> test failed" >> $out + echo -e " --> \n ONE TEST FAILED\n" >> $out fi fi @@ -101,17 +115,17 @@ if [ $tsts1 -eq 0 ] then - echo " start(\"[-]\", Map(0 -> 100)) == Map(0 -> 0)" >> $out - echo " start(\"[->+<]\", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)" >> $out - echo " start(\"[>>+>>+<<<<-]\", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)" >> $out - echo " start({{hello world prg 1}}, Map()) == " >> $out - echo " Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)" >> $out + echo -e " run(\"[-]\", Map(0 -> 100)) == Map(0 -> 0)" >> $out + echo -e " run(\"[->+<]\", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)" >> $out + echo -e " run(\"[>>+>>+<<<<-]\", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)" >> $out + echo -e " run(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++" >> $out + echo -e " <<]>>++<<----------[+>.>.<+<]\"\"\") == Map(0 -> 0, 1 -> 58, 2 -> 32)" >> $out - if (scala_assert "bf.scala" "bf1c_test.scala") + if (scala_assert "bf.scala" "bf_test4.scala") then - echo " --> success" >> $out + echo -e " --> success" >> $out else - echo " --> test failed" >> $out + echo -e " --> \n ONE TEST FAILED\n" >> $out fi fi