main_marking2/danube_test.sh
changeset 424 daf561a83ba6
parent 390 175a950470a9
--- a/main_marking2/danube_test.sh	Thu Jan 13 12:55:03 2022 +0000
+++ b/main_marking2/danube_test.sh	Mon Apr 11 23:55:27 2022 +0100
@@ -37,9 +37,9 @@
 }
 
 # purity test
-
 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)
+   (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)
 }
 
 
@@ -111,6 +111,9 @@
   echo -e  "  " | tee -a $out
   echo -e  "  good_ratings.length == 48580 " | tee -a $out
   echo -e  "  movie_names.length == 9742 " | tee -a $out
+  echo -e  "  "  | tee -a $out
+  echo -e  "  val r_elems = List((\"1\",\"1\"), (\"1\",\"3\"), (\"1\",\"6\"), (\"1\",\"47\")) " | tee -a $out
+  echo -e  "  r_elems.forall(good_ratings.contains(_)) == true" | tee -a $out
 
   if (scala_assert "danube.scala" "danube_test2.scala") 
   then
@@ -201,57 +204,6 @@
   fi
 fi
 
-### danube most_recommended 1
-gd=$(( 0 ))
-
-if [ $tsts -eq 0 ]
-then
-    echo -e  "  val rmap =  Map(\"1\" -> List(\"b\", \"a\"), " | tee -a $out
-    echo -e  "                  \"2\" -> List(\"y\", \"x\"), " | tee -a $out
-    echo -e  "                  \"3\" -> List(\"c\", \"a\")) " | tee -a $out
-    echo -e  "  val nmap = Map(\"a\" -> \"A\", \"b\" -> \"B\", \"c\" -> \"C\",  " | tee -a $out
-    echo -e  "                 \"x\" -> \"X\", \"y\" -> \"Y\") " | tee -a $out
-    echo -e  "  most_recommended(rmap, nmap).toSet == " | tee -a $out
-    echo -e  "      Set((\"A\",2), (\"B\",1), (\"C\",1), (\"X\",1), (\"Y\",1)) " | tee -a $out
-
-  if (scala_assert "danube.scala" "danube_test7a.scala") 
-  then
-      echo -e  "  --> success (0.5% Marks)" | tee -a $out
-      marks=$(( marks + 0.5 ))
-  else
-      echo -e  "  --> TEST FAILED\n" | tee -a $out
-      gd=$(( 1 ))
-  fi
-fi
-
-### danube most_recommended 2
-
-sleep 10
-
-if [ $gd -eq 0 ]
-then
-   if [ $tsts -eq 0 ]
-   then
-       echo -e  "  most_recommended(ratings_map, movie_map) runs within allocated time? " | tee -a $out
-       START=$(date +%s)
-       
-       if (scala_assert_thirty "danube.scala" "danube_test7b.scala") 
-       then
-	   END=$(date +%s)
-	   DIFF=$(( $END - $START ))
-	   echo "   This test ran for $DIFF seconds." | tee -a $out 
-	   echo -e  "  --> success (0.5% Marks)" | tee -a $out
-	   marks=$(( marks + 0.5 ))  
-       else
-	   END=$(date +%s)
-	   DIFF=$(( $END - $START ))
-	   echo "  This test ran for $DIFF seconds." | tee -a $out 
-	   echo -e  "  --> TEST FAILED\n" | tee -a $out
-       fi
-   fi
-fi   
-
-sleep 10
 
 
 ## final marks