--- a/main_testing2/danube_test.sh Mon Jan 10 13:51:59 2022 +0000
+++ b/main_testing2/danube_test.sh Thu Jan 13 12:34:43 2022 +0000
@@ -4,7 +4,11 @@
set -euo pipefail
-out=${1:-output}
+
+scalafile=${1:-danube.scala}
+out=${2:-output}
+
+
echo "" > $out
@@ -36,7 +40,7 @@
echo "danube.scala runs?" >> $out
-if (scala_compile danube.scala)
+if (scala_compile $scalafile)
then
echo " --> passed" >> $out
tsts=$(( 0 ))
@@ -52,7 +56,7 @@
then
echo "danube.scala does not contain vars, returns etc?" >> $out
- if (scala_vars danube.scala)
+ if (scala_vars $scalafile)
then
echo " --> FAIL (make triple-sure your program conforms to the required format)" >> $out
tsts=$(( 1 ))
@@ -71,7 +75,7 @@
echo " val movies_url = \"\"\"https://nms.kcl.ac.uk/christian.urban/movies.csv\"\"\"" >> $out
echo " get_csv_url(movies_url).length == 9742" >> $out
- if (scala_assert "danube.scala" "danube_test1.scala")
+ if (scala_assert $scalafile "danube_test1.scala")
then
echo -e " --> success" >> $out
else
@@ -88,8 +92,11 @@
echo " " >> $out
echo " good_ratings.length == 48580 " >> $out
echo " movie_names.length == 9742 " >> $out
+ echo " " >> $out
+ echo " val r_elems = List((\"1\",\"1\"), (\"1\",\"3\"), (\"1\",\"6\"), (\"1\",\"47\")) " >> $out
+ echo " r_elems.forall(good_ratings.contains(_)) == true" >> $out
- if (scala_assert "danube.scala" "danube_test2.scala")
+ if (scala_assert $scalafile "danube_test2.scala")
then
echo -e " --> success" >> $out
else
@@ -111,7 +118,7 @@
echo -e " val ls5 = ls4 ::: ls4.reverse" >> $out
echo -e " groupById(ls5, Map()) == Map(1 -> List(2,2), 2 -> List(3,3), ....)" >> $out
- if (scala_assert "danube.scala" "danube_test3.scala")
+ if (scala_assert $scalafile "danube_test3.scala")
then
echo -e " --> success" >> $out
else
@@ -129,7 +136,7 @@
echo -e " favourites(ratings_map, \"858\").length == 158 " >> $out
echo -e " favourites(ratings_map, \"260\").length == 201 " >> $out
- if (scala_assert "danube.scala" "danube_test4.scala")
+ if (scala_assert $scalafile "danube_test4.scala")
then
echo -e " --> success" >> $out
else
@@ -147,7 +154,7 @@
echo -e " suggestions(ratings_map, \"858\").length == 4883 " >> $out
echo -e " suggestions(ratings_map, \"260\").length == 4970 " >> $out
- if (scala_assert "danube.scala" "danube_test5.scala")
+ if (scala_assert $scalafile "danube_test5.scala")
then
echo -e " --> success" >> $out
else
@@ -165,7 +172,7 @@
echo -e " recommendations(ratings_map, movies_map, \"4\").length == 0 " >> $out
echo -e " recommendations(ratings_map, movies_map, \"5\").length == 2 " >> $out
- if (scala_assert "danube.scala" "danube_test6.scala")
+ if (scala_assert $scalafile "danube_test6.scala")
then
echo -e " --> success" >> $out
else