# HG changeset patch # User Christian Urban # Date 1484146576 0 # Node ID 085bf16963c6699050603320c3a2a869611691f6 # Parent 139eb1ed2d579fcd2c70d1652d65234e14dfba12 updated diff -r 139eb1ed2d57 -r 085bf16963c6 marking/mark02 --- a/marking/mark02 Wed Jan 11 14:46:37 2017 +0000 +++ b/marking/mark02 Wed Jan 11 14:56:16 2017 +0000 @@ -12,7 +12,7 @@ echo "" >> $out function scala_vars { - (egrep '\bvar\b|\breturn\b|ListBuffer|mutable' "$1" 2> /dev/null 1> /dev/null) + (egrep 'var|return|ListBuffer|mutable' "$1" 2> /dev/null 1> /dev/null) } @@ -189,6 +189,38 @@ fi +# knights3: var, comments test +# +#echo "knight3.scala does not contain vars, returns etc?" | tee -a $out + +#if (scala_vars knight3.scala) +#then +# echo " --> fail" | tee -a $out +# tsts0=$(( 1 )) +#else +# echo " --> success" | tee -a $out +# tsts0=$(( 0 )) +#fi + + +# compilation test +#if [ $tsts0 -eq 0 ] +#then +# echo "knight3.scala runs?" | tee -a $out +# +# if (scala_compile knight3.scala.bak) +# then +# echo " --> success" | tee -a $out +# tsts1=$(( 0 )) +# else +# echo " --> scala did not run knight3.scala" | tee -a $out +# tsts1=$(( 1 )) +# fi +#else +# tsts1=$(( 1 )) +#fi + + ## final marks -echo "Overall mark for CW 7, Part 1 " | tee -a $out +echo "Overall mark for CW 2, Part 1 " | tee -a $out echo "$marks" | tee -a $out diff -r 139eb1ed2d57 -r 085bf16963c6 marking/mark02b --- a/marking/mark02b Wed Jan 11 14:46:37 2017 +0000 +++ b/marking/mark02b Wed Jan 11 14:56:16 2017 +0000 @@ -26,7 +26,7 @@ # functional tests function scala_assert { - (scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) + (scala -i "$1" "$2" -e "") # 2> /dev/null 1> /dev/null) } @@ -65,12 +65,11 @@ tsts1=$(( 1 )) fi - if [ $tsts1 -eq 0 ] then - echo " ordered_moves(8, List((3,4), (3,2)), (1,3)) == (0,1), (0,5), (2,1), (2,5)" | tee -a $out - echo " ordered_moves(8, List((4,0)), (0,0)) == (2,1), (1,2)" | tee -a $out - echo " ordered_moves(8, List((0,4)), (0,0)) == (1,2), (2,1)" | tee -a $out + echo " ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5))" | tee -a $out + echo " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" | tee -a $out + echo " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" | tee -a $out if (scala_assert "knight3.scala.bak" "../../../marking/knight3a_test.scala") then @@ -83,7 +82,7 @@ if [ $tsts1 -eq 0 ] then - echo " first_closed_tour_heuristic(6, List((3, 3))) is ok?" | tee -a $out + echo " first_closed_tour_heuristic(6, List((3, 3))) found and ok?" | tee -a $out if (scala_assert "knight3.scala.bak" "../../../marking/knight3b_test.scala") then @@ -94,6 +93,20 @@ fi fi +if [ $tsts1 -eq 0 ] +then + echo " first_tour_heuristic(8, List((0,0))) found and ok?" | tee -a $out + echo " first_tour_heuristic(50, List((0,0))) found and ok?" | tee -a $out + + if (scala_assert "knight3.scala.bak" "../../../marking/knight3c_test.scala") + then + echo " --> success" | tee -a $out + marks=$(( marks + 1 )) + else + echo " --> test failed" | tee -a $out + fi +fi + ## final marks echo "Overall mark for CW 7, Part 2" | tee -a $out