updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 11 Jan 2017 14:56:16 +0000
changeset 102 085bf16963c6
parent 101 139eb1ed2d57
child 103 350d4364f6f9
updated
marking/mark02
marking/mark02b
--- 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
--- 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