updated
authorChristian Urban <urbanc@in.tum.de>
Tue, 29 Oct 2019 23:56:13 +0000
changeset 283 ef5f62bf5987
parent 282 ec9773fe1dc0
child 284 9a04eb6a2291
updated
README
marking2/danube_test.sh
marking2/docdiff.scala
marking2/docdiff_test.sh
marking2/docdiff_test1.scala
marking2/docdiff_test2.scala
marking2/docdiff_test3.scala
marking2/docdiff_test4.scala
solutions2/docdiff.scala
templates2/docdiff.scala
testing2/danube_test.sh
testing2/docdiff.scala
testing2/docdiff_test.sh
testing2/docdiff_test1.scala
testing2/docdiff_test2.scala
testing2/docdiff_test3.scala
testing2/docdiff_test4.scala
--- a/README	Tue Oct 29 14:34:51 2019 +0000
+++ b/README	Tue Oct 29 23:56:13 2019 +0000
@@ -1,3 +1,12 @@
+Decompilation 
+
+
+java -jar procyon-decompiler-0.5.36.jar -jar templates1/drumb.jar -o out
+
+
+-------------------------
+
+
 Brain fuck optimizer
 
 https://github.com/Dash-Lambda/Eso/blob/master/src/main/scala/interpreters/BFOptimized.scala
--- a/marking2/danube_test.sh	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/danube_test.sh	Tue Oct 29 23:56:13 2019 +0000
@@ -20,13 +20,13 @@
 # compilation tests
 
 function scala_compile {
-    (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$1" 2>> $out 1>> $out)
+    (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out)
 }
 
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "") #2> /dev/null 1> /dev/null)
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
--- a/marking2/docdiff.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,8 +1,8 @@
-// Part 1 about Code Similarity
-//==============================
+// Preliminary Part about Code Similarity
+//========================================
 
 
-//object CW7a { // for purposes of generating a jar
+object CW7a { 
 
 //(1) Complete the clean function below. It should find
 //    all words in a string using the regular expression
@@ -114,4 +114,4 @@
 */
 
 
-//}
+}
--- a/marking2/docdiff_test.sh	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff_test.sh	Tue Oct 29 23:56:13 2019 +0000
@@ -8,14 +8,14 @@
 
 echo "" > $out
 
-echo "Below is the feedback and provisional marks for your submission" >> $out
-echo "for assignment 7 Part 1 + 2.  Please note all marks are provisional until" >> $out
-echo "ratified by the assessment board -- this is not an official" >> $out
-echo "results transcript." >> $out
-echo "" >> $out
+echo -e "Below is the feedback and provisional marks for your submission" >> $out
+echo -e "for the Preliminary Part of Assignemnt 7.  Please note all marks are provisional until" >> $out
+echo -e "ratified by the assessment board -- this is not an official" >> $out
+echo -e "results transcript." >> $out
+echo -e "" >> $out
 
-echo "Below is the feedback for your submission docdiff.scala" >> $out
-echo "" >> $out
+echo -e "Below is the feedback for your submission docdiff.scala" >> $out
+echo -e "" >> $out
 
 # marks for CW7 parts 1 + 2
 marks=$(( 0 ))
@@ -24,13 +24,13 @@
 # compilation tests
 
 function scala_compile {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$1" 2>> $out 1>> $out) 
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
 }
 
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
@@ -42,14 +42,14 @@
 
 # var, .par return, ListBuffer test
 #
-echo "docdiff.scala does not contain vars, returns etc?" |  tee -a $out
+echo -e "docdiff.scala does not contain vars, returns etc?" |  tee -a $out
 
 if (scala_vars docdiff.scala)
 then
-  echo "  --> test failed" | tee -a $out  
+  echo -e "  --> FAIL (make triple-sure your program conforms to the required format)\n" | tee -a $out  
   tsts0=$(( 1 ))
 else
-  echo "  --> success" |  tee -a $out
+  echo -e "  --> success" |  tee -a $out
   tsts0=$(( 0 )) 
 fi
 
@@ -58,14 +58,14 @@
 
 if  [ $tsts0 -eq 0 ]
 then 
-  echo "docdiff.scala runs?" |  tee -a $out
+  echo -e "docdiff.scala runs?" |  tee -a $out
 
   if (scala_compile docdiff.scala)
   then
-    echo "  --> success" |  tee -a $out
+    echo -e "  --> success" |  tee -a $out
     tsts=$(( 0 ))
   else
-    echo "  --> scala did not run docdiff.scala" |  tee -a $out
+    echo -e "  --> scala did not run docdiff.scala" |  tee -a $out
     tsts=$(( 1 )) 
   fi
 else
@@ -76,16 +76,16 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "docdiff.scala tests:" |  tee -a $out
-  echo "  clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" |  tee -a $out
-  echo "  clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" |  tee -a $out
+  echo -e "docdiff.scala tests:" |  tee -a $out
+  echo -e "  clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" |  tee -a $out
+  echo -e "  clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" |  tee -a $out
 
   if (scala_assert "docdiff.scala" "docdiff_test1.scala")
   then
-      echo "  --> success" |  tee -a $out
+      echo -e "  --> success" |  tee -a $out
       marks=$(( marks + 1 ))
   else
-    echo "  --> one of the tests failed" |  tee -a $out
+      echo -e "  --> ONE OF THE TESTS FAILED\n" |  tee -a $out
   fi
 fi
 
@@ -93,18 +93,18 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " |  tee -a $out
-  echo "      Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" |  tee -a $out
-  echo "  " |  tee -a $out
-  echo "  occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " |  tee -a $out
-  echo "      Map(\"d\" -> 3, \"b\" -> 2)" |  tee -a $out
+  echo -e "  occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " |  tee -a $out
+  echo -e "      Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" |  tee -a $out
+  echo -e "  " |  tee -a $out
+  echo -e "  occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " |  tee -a $out
+  echo -e "      Map(\"d\" -> 3, \"b\" -> 2)" |  tee -a $out
 
   if (scala_assert "docdiff.scala" "docdiff_test2.scala") 
   then
-      echo "  --> success" |  tee -a $out
+      echo -e "  --> success" |  tee -a $out
       marks=$(( marks + 1 ))
   else
-    echo "  --> one of the tests failed" |  tee -a $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" |  tee -a $out
   fi
 fi
 
@@ -112,19 +112,19 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" |  tee -a $out
-  echo "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" |  tee -a $out
-  echo "  " |  tee -a $out
-  echo "  prod(l1, l2) == 7 " |  tee -a $out
-  echo "  prod(l1, l1) == 7 " |  tee -a $out
-  echo "  prod(l2, l2) == 13 " |  tee -a $out
+  echo -e "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" |  tee -a $out
+  echo -e "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" |  tee -a $out
+  echo -e "  " |  tee -a $out
+  echo -e "  prod(l1, l2) == 7 " |  tee -a $out
+  echo -e "  prod(l1, l1) == 7 " |  tee -a $out
+  echo -e "  prod(l2, l2) == 13 " |  tee -a $out
 
   if (scala_assert "docdiff.scala" "docdiff_test3.scala") 
   then
-      echo "  --> success" |  tee -a $out
+      echo -e "  --> success" |  tee -a $out
       marks=$(( marks + 1 ))
   else
-    echo "  --> one of the tests failed" |  tee -a $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" |  tee -a $out
   fi
 fi
 
@@ -132,24 +132,24 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" |  tee -a $out
-  echo "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" |  tee -a $out
-  echo "  " |  tee -a $out
-  echo "  overlap(l1, l2) == 0.5384615384615384 " |  tee -a $out
-  echo "  overlap(l1, l1) == 1.0 " |  tee -a $out
-  echo "  overlap(l2, l2) == 1.0 " |  tee -a $out
+  echo -e "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" |  tee -a $out
+  echo -e "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" |  tee -a $out
+  echo -e "  " |  tee -a $out
+  echo -e "  overlap(l1, l2) == 0.5384615384615384 " |  tee -a $out
+  echo -e "  overlap(l1, l1) == 1.0 " |  tee -a $out
+  echo -e "  overlap(l2, l2) == 1.0 " |  tee -a $out
 
   if (scala_assert "docdiff.scala" "docdiff_test4.scala") 
   then
-      echo "  --> success" |  tee -a $out
+      echo -e "  --> success" |  tee -a $out
       marks=$(( marks + 1 ))
   else
-    echo "  --> one of the tests failed" |  tee -a $out
+      echo -e "  --> ONE OF THE TESTS FAILED\n" |  tee -a $out
   fi
 fi
 
 
 ## final marks
-echo "Overall mark for Part 1" | tee -a $out
-echo " $marks" | tee -a $out
+echo -e "Overall mark for the Preliminary Part" | tee -a $out
+echo -e " $marks" | tee -a $out
 
--- a/marking2/docdiff_test1.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff_test1.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,6 +1,5 @@
 
+import CW7a._
 
 assert(clean("ab a abc") == List("ab", "a", "abc"))
-
-
 assert(clean("ab*a abc1") == List("ab", "a", "abc1"))
--- a/marking2/docdiff_test2.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff_test2.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,4 +1,5 @@
 
+import CW7a._
 
 assert(occurrences(List("a", "b", "b", "c", "d")) == Map("a" -> 1, "b" -> 2, "c" -> 1, "d" -> 1))
 
--- a/marking2/docdiff_test3.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff_test3.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,10 +1,9 @@
 
+import CW7a._
 
 val urban_list1 = List("a", "b", "b", "c", "d")
 val urban_list2 = List("d", "b", "d", "b", "d")
 
 assert(prod(urban_list1, urban_list2) == 7)
-
 assert(prod(urban_list1, urban_list1) == 7)
-
 assert(prod(urban_list2, urban_list2) == 13)
--- a/marking2/docdiff_test4.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/marking2/docdiff_test4.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,10 +1,9 @@
 
+import CW7a._
 
 val urban_list1 = List("a", "b", "b", "c", "d")
 val urban_list2 = List("d", "b", "d", "b", "d")
 
 assert(overlap(urban_list1, urban_list2) == 0.5384615384615384)
-
 assert(overlap(urban_list1, urban_list1) == 1.0)
-
 assert(overlap(urban_list2, urban_list2) == 1.0)
--- a/solutions2/docdiff.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/solutions2/docdiff.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,8 +1,8 @@
-// Part 1 about Code Similarity
-//==============================
+// Preliminary Part about Code Similarity
+//========================================
 
 
-object CW7a { // for purposes of generating a jar
+object CW7a { 
 
 //(1) Complete the clean function below. It should find
 //    all words in a string using the regular expression
--- a/templates2/docdiff.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/templates2/docdiff.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,5 +1,9 @@
-// Part 1 about Code Similarity
-//==============================
+// Preliminary Part about Code Similarity
+//========================================
+
+
+object CW7a { 
+
 
 //(1) Complete the clean function below. It should find
 //    all words in a string using the regular expression
@@ -108,3 +112,5 @@
 // should be investigated by staff.
 
 */
+
+}
--- a/testing2/danube_test.sh	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/danube_test.sh	Tue Oct 29 23:56:13 2019 +0000
@@ -21,7 +21,7 @@
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
--- a/testing2/docdiff.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,8 +1,8 @@
-// Part 1 about Code Similarity
-//==============================
+// Preliminary Part about Code Similarity
+//========================================
 
 
-//object CW7a { // for purposes of generating a jar
+object CW7a { // for purposes of generating a jar
 
 //(1) Complete the clean function below. It should find
 //    all words in a string using the regular expression
@@ -114,4 +114,4 @@
 */
 
 
-//}
+}
--- a/testing2/docdiff_test.sh	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff_test.sh	Tue Oct 29 23:56:13 2019 +0000
@@ -15,13 +15,13 @@
 # compilation tests
 
 function scala_compile {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$1" 2>> $out 1>> $out) 
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
 }
 
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
 }
 
 # purity test
@@ -37,10 +37,10 @@
 
 if (scala_vars docdiff.scala)
 then
-  echo "  --> fail (make triple-sure your program conforms to the required format)" >> $out
+  echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out
   tsts0=$(( 0 ))
 else
-  echo "  --> success" >> $out
+  echo -e "  --> success" >> $out
   tsts0=$(( 0 )) 
 fi
 
@@ -53,10 +53,10 @@
 
   if (scala_compile docdiff.scala)
   then
-    echo "  --> success" >> $out
+    echo -e "  --> success" >> $out
     tsts=$(( 0 ))
   else
-    echo "  --> scala did not run docdiff.scala" >> $out
+    echo -e "  --> SCALA DID NOT RUN docdiff.scala" >> $out
     tsts=$(( 1 )) 
   fi
 else
@@ -67,15 +67,15 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "docdiff.scala tests:" >> $out
-  echo "  clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" >> $out
-  echo "  clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" >> $out
+  echo -e "docdiff.scala tests:" >> $out
+  echo -e "  clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" >> $out
+  echo -e "  clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" >> $out
 
   if (scala_assert "docdiff.scala" "docdiff_test1.scala")
   then
-    echo "  --> success" >> $out
+    echo -e "  --> success\n" >> $out
   else
-    echo "  --> one of the tests failed" >> $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
   fi
 fi
 
@@ -83,17 +83,17 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " >> $out
-  echo "      Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" >> $out
-  echo "  " >> $out
-  echo "  occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " >> $out
-  echo "      Map(\"d\" -> 3, \"b\" -> 2)" >> $out
+  echo -e "  occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " >> $out
+  echo -e "      Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" >> $out
+  echo -e "  " >> $out
+  echo -e "  occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " >> $out
+  echo -e "      Map(\"d\" -> 3, \"b\" -> 2)" >> $out
 
   if (scala_assert "docdiff.scala" "docdiff_test2.scala") 
   then
-    echo "  --> success" >> $out
+    echo -e "  --> success\n" >> $out
   else
-    echo "  --> one of the tests failed" >> $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
   fi
 fi
 
@@ -101,18 +101,18 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out
-  echo "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out
-  echo "  " >> $out
-  echo "  prod(l1, l2) == 7 " >> $out
-  echo "  prod(l1, l1) == 7 " >> $out
-  echo "  prod(l2, l2) == 13 " >> $out
+  echo -e "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out
+  echo -e "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out
+  echo -e "  " >> $out
+  echo -e "  prod(l1, l2) == 7 " >> $out
+  echo -e "  prod(l1, l1) == 7 " >> $out
+  echo -e "  prod(l2, l2) == 13 " >> $out
 
   if (scala_assert "docdiff.scala" "docdiff_test3.scala") 
   then
-    echo "  --> success" >> $out
+    echo -e "  --> success\n" >> $out
   else
-    echo "  --> one of the tests failed" >> $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
   fi
 fi
 
@@ -120,17 +120,17 @@
 
 if [ $tsts -eq 0 ]
 then
-  echo "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out
-  echo "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out
-  echo "  " >> $out
-  echo "  overlap(l1, l2) == 0.5384615384615384 " >> $out
-  echo "  overlap(l1, l1) == 1.0 " >> $out
-  echo "  overlap(l2, l2) == 1.0 " >> $out
+  echo -e "  val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out
+  echo -e "  val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out
+  echo -e "  " >> $out
+  echo -e "  overlap(l1, l2) == 0.5384615384615384 " >> $out
+  echo -e "  overlap(l1, l1) == 1.0 " >> $out
+  echo -e "  overlap(l2, l2) == 1.0 " >> $out
 
   if (scala_assert "docdiff.scala" "docdiff_test4.scala") 
   then
-    echo "  --> success" >> $out
+    echo -e "  --> success\n" >> $out
   else
-    echo "  --> one of the tests failed" >> $out
+    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
   fi
 fi
--- a/testing2/docdiff_test1.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff_test1.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,6 +1,6 @@
 
+import CW7a._
 
 assert(clean("ab a abc") == List("ab", "a", "abc"))
 
-
 assert(clean("ab*a abc1") == List("ab", "a", "abc1"))
--- a/testing2/docdiff_test2.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff_test2.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,4 +1,5 @@
 
+import CW7a._
 
 assert(occurrences(List("a", "b", "b", "c", "d")) == Map("a" -> 1, "b" -> 2, "c" -> 1, "d" -> 1))
 
--- a/testing2/docdiff_test3.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff_test3.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,4 +1,5 @@
 
+import CW7a._
 
 val urban_list1 = List("a", "b", "b", "c", "d")
 val urban_list2 = List("d", "b", "d", "b", "d")
--- a/testing2/docdiff_test4.scala	Tue Oct 29 14:34:51 2019 +0000
+++ b/testing2/docdiff_test4.scala	Tue Oct 29 23:56:13 2019 +0000
@@ -1,4 +1,5 @@
 
+import CW7a._
 
 val urban_list1 = List("a", "b", "b", "c", "d")
 val urban_list2 = List("d", "b", "d", "b", "d")