main_marking1/drumb_test.sh
changeset 424 daf561a83ba6
parent 388 ed63dca8068a
child 463 0315d9983cd0
--- a/main_marking1/drumb_test.sh	Thu Jan 13 12:55:03 2022 +0000
+++ b/main_marking1/drumb_test.sh	Mon Apr 11 23:55:27 2022 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/zsh
 
 # to make the script fail safely
 set -euo pipefail
@@ -16,7 +16,7 @@
 echo -e "" >> $out
 
 # marks for CW6 main part 
-marks=$(( 0 ))
+marks=$(( 0.0 ))
 
 
 echo -e "" >> $out
@@ -38,10 +38,11 @@
 
 
 # purity test
+function scala_vars {
+   (sed 's/immutable/ok/g' c$out > cb$out;
+    egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
+}
 
-function scala_vars {
-   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
-}
 
 # compilation test
 echo -e "drumb.scala runs?" | tee -a $out
@@ -76,8 +77,6 @@
 
 echo >> $out
 
-sleep 15
-
 ### get january tests
 
 if [ $tsts -eq 0 ]
@@ -88,7 +87,7 @@
   if (scala_assert "drumb.scala" "drumb_test1.scala")
   then
       echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+      marks=$(( marks + 0.5 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -104,7 +103,7 @@
   if (scala_assert "drumb.scala" "drumb_test2.scala")
   then
       echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+      marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -126,7 +125,7 @@
   if (scala_assert "drumb.scala" "drumb_test3.scala")
   then
       echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+      marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -144,7 +143,7 @@
   if (scala_assert "drumb.scala" "drumb_test4.scala")
   then
       echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+      marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -166,7 +165,7 @@
   if (scala_assert "drumb.scala" "drumb_test5.scala") 
   then
      echo -e "  --> success" | tee -a $out
-     marks=$(( marks + 1 ))
+     marks=$(( marks + 1.0 ))
   else
      echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -184,7 +183,7 @@
   if (scala_assert "drumb.scala" "drumb_test6.scala") 
   then
       echo -e "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
+      marks=$(( marks + 1.0 ))
   else
       echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -210,7 +209,7 @@
   if (scala_assert "drumb.scala" "drumb_test7.scala") 
   then
     echo -e "  --> success" | tee -a $out
-    marks=$(( marks + 1 ))
+    marks=$(( marks + 0.5 ))
   else
     echo -e "  --> TEST FAILED\n" | tee -a $out
   fi
@@ -219,7 +218,6 @@
 ## final marks
 echo -e "" >> $out
 echo -e "Overall mark for Main Part 1 (Scala)" | tee -a $out
-echo -e "$marks" | tee -a $out
+printf " %0.1f\n" $marks | tee -a $out
 
 
-sleep 10