--- a/pre_marking3/postfix_test.sh Mon Jan 18 22:12:39 2021 +0000
+++ b/pre_marking3/postfix_test.sh Fri Jan 22 10:35:50 2021 +0000
@@ -30,7 +30,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" -e "") # 2> /dev/null 1> /dev/null)
}
# purity test
--- a/pre_marking4/knight1_test.sh Mon Jan 18 22:12:39 2021 +0000
+++ b/pre_marking4/knight1_test.sh Fri Jan 22 10:35:50 2021 +0000
@@ -8,12 +8,14 @@
echo "" > $out
echo `date` >> $out
+echo -e "" >> $out
echo -e "Below is the feedback and provisional marks for your submission" >> $out
echo -e "of the Preliminary Part of Part 4 (Scala). 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 -e "" >> $out
echo -e "Below is the feedback for your submission knight1.scala" >> $out
echo -e "" >> $out
@@ -22,12 +24,7 @@
# marks for CW8 part 1
marks=$(( 0.0 ))
-
-function scala_compile {
- (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1") # 2>> $out 1>> $out)
-}
-
-# functional tests
+# compilation tests
function scala_compile {
(ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
@@ -44,7 +41,7 @@
}
function scala_assert_thirty {
- (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
+ (ulimit -t 40; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
}
function scala_assert_quick {
@@ -98,7 +95,7 @@
tsts=$(( 1 ))
fi
-
+echo >> $out
### knight1 test
@@ -144,68 +141,70 @@
if [ $tsts -eq 0 ]
then
- echo " count_tours from every position on the board 1 - 4" | tee -a $out
+ echo " count_tours from every position on the board 1 - 4 (0.5% marks)" | tee -a $out
echo " dim = 1: 1" | tee -a $out
echo " 2: 0,0,0,0" | tee -a $out
echo " 3: 0,0,0,0,0,0,0,0,0" | tee -a $out
echo " 4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" | tee -a $out
START=$(date +%s)
- if (scala_assert "knight1.scala" "knight1_test3a.scala")
+ if (scala_assert_thirty "knight1.scala" "knight1_test3a.scala")
then
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ #echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> success\n" | tee -a $out
marks=$(( marks + 0.5 ))
else
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> ONE TEST FAILED\n" | tee -a $out
fi
fi
+
if [ $tsts -eq 0 ]
then
- echo " count_tours from every position on the board of dim 5" | tee -a $out
- echo " dim = 5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" | tee -a $out
+ echo " count_tours from every position on the board of dim 5 for the first 3 rows (0.5% marks)" | tee -a $out
+ echo " dim = 5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56)" | tee -a $out
START=$(date +%s)
- if (scala_assert "knight1.scala" "knight1_test3b.scala")
+ if (scala_assert_thirty "knight1.scala" "knight1_test3b.scala")
then
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ #echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> success\n" | tee -a $out
marks=$(( marks + 0.5 ))
else
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> ONE TEST FAILED\n" | tee -a $out
fi
fi
+
if [ $tsts -eq 0 ]
then
echo " enum_tours(5, List((0,2)) ) => 56 tours? and all correct?" | tee -a $out
echo " enum_tours(5, List((0,0)) ) => 304 tours? and all correct?" | tee -a $out
START=$(date +%s)
- if (scala_assert "knight1.scala" "knight1_test3c.scala")
+ if (scala_assert_thirty "knight1.scala" "knight1_test3c.scala")
then
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ #echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> success\n" | tee -a $out
marks=$(( marks + 1.0 ))
else
END=$(date +%s)
DIFF=$(( $END - $START ))
- echo " It took $DIFF seconds" | tee -a $out
+ echo " This test ran for $DIFF seconds." | tee -a $out
echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
fi
fi
@@ -216,3 +215,4 @@
printf " %0.1f\n" $marks | tee -a $out
+
--- a/pre_marking4/knight1_test3b.scala Mon Jan 18 22:12:39 2021 +0000
+++ b/pre_marking4/knight1_test3b.scala Fri Jan 22 10:35:50 2021 +0000
@@ -2,11 +2,18 @@
//type Pos = (Int, Int) // a position on a chessboard
//type Path = List[Pos] // a path...a list of positions
+/*
def count_all_tours_urban(dim: Int) = {
for (i <- (0 until dim).toList;
j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
}
+*/
+
+def count_all_tours_urban(dim: Int) = {
+ for (i <- (0 until 3).toList;
+ j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
+}
-assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56, 0, 56, 0, 56, 0, 304, 0, 56, 0, 304))
+assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56))