pre_marking4/knight1_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 22 Jan 2021 10:35:50 +0000
changeset 387 6282b88511d8
parent 386 e2170c91a9f2
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
#!/bin/zsh
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
# to make the script fail safely
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
set -euo pipefail
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
out=${1:-output}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
echo "" > $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
echo `date` >> $out
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
    11
echo -e "" >> $out
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
echo -e "Below is the feedback and provisional marks for your submission" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
echo -e "of the Preliminary Part of Part 4 (Scala).  Please note all marks are provisional until" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
echo -e "ratified by the assessment board -- this is not an official" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
echo -e "results transcript." >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
echo -e "" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
    18
echo -e "" >> $out
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
echo -e "Below is the feedback for your submission knight1.scala" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
echo -e "" >> $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
# marks for CW8 part 1
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
marks=$(( 0.0 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
    27
# compilation tests
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
function scala_compile {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
# functional tests
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35
function scala_assert {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    36
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    37
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    38
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    39
function scala_assert_slow {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    40
  (ulimit -t 120; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)  
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    41
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    42
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    43
function scala_assert_thirty {
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
    44
  (ulimit -t 40; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)  
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    45
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    46
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    47
function scala_assert_quick {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    48
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)    
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    49
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    50
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    51
function scala_assert_long {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    52
  (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)    
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    53
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    54
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    55
function scala_assert_elong {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    56
  (ulimit -t 90; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null) 
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    57
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    58
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    59
# purity test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    60
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    61
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    62
function scala_vars {
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    63
   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    64
}
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    65
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    66
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    67
# compilation test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    68
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    69
echo -e "knight1.scala runs?" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    70
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    71
if (scala_compile knight1.scala)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    72
then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    73
    echo -e "  --> success " | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    74
    tsts=$(( 0 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    75
else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    76
    echo -e "  --> SCALA DID NOT RUN KNIGHT1.SCALA\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    77
    tsts=$(( 1 )) 
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    78
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    79
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    80
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    81
# knights1: purity test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    82
if  [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    83
  then   
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    84
  echo -e "knight1.scala does not contain VARS, RETURNS etc?" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    85
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    86
  if (scala_vars knight1.scala)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    87
  then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    88
     echo -e "  --> FAIL\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    89
     tsts=$(( 1 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    90
  else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    91
     echo -e "  --> success" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    92
     tsts=$(( 0 )) 
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    93
  fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    94
else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    95
  tsts=$(( 1 ))  
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    96
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    97
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
    98
echo >> $out
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    99
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   100
### knight1 test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   101
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   102
if [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   103
then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   104
    echo " is_legal(8, Nil, (3, 4)) == true " | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   105
    echo " is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false " | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   106
    echo " is_legal(2, Nil, (0, 0)) == true" | tee -a $out                          
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   107
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   108
    if (scala_assert "knight1.scala" "knight1_test1.scala")
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   109
    then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   110
        echo -e "  --> success" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   111
	marks=$(( marks + 1.0 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   112
    else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   113
        echo -e "  --> \n ONE TEST FAILED\n"| tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   114
    fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   115
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   116
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   117
### knight2 test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   118
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   119
if [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   120
then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   121
  echo " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   122
  echo " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   123
  echo " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   124
  echo " legal_moves(8, Nil, (0,1)) == List((1,3), (2,2), (2,0))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   125
  echo " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   126
  echo " legal_moves(1, Nil, (0,0)) == Nil" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   127
  echo " legal_moves(2, Nil, (0,0)) == Nil" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   128
  echo " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   129
  
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   130
  if (scala_assert "knight1.scala" "knight1_test2.scala")
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   131
  then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   132
     echo -e "  --> success\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   133
     marks=$(( marks + 1 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   134
  else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   135
     echo -e "  --> ONE TEST FAILED\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   136
  fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   137
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   138
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   139
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   140
### knight3 test
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   141
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   142
if [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   143
then
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   144
  echo " count_tours from every position on the board 1 - 4 (0.5% marks)" | tee -a $out
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   145
  echo " dim = 1: 1" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   146
  echo "       2: 0,0,0,0" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   147
  echo "       3: 0,0,0,0,0,0,0,0,0" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   148
  echo "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   149
  START=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   150
  
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   151
  if (scala_assert_thirty "knight1.scala" "knight1_test3a.scala") 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   152
  then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   153
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   154
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   155
     #echo " This test ran for $DIFF seconds." | tee -a $out  
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   156
     echo -e "  --> success\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   157
     marks=$(( marks + 0.5 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   158
  else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   159
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   160
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   161
     echo " This test ran for $DIFF seconds." | tee -a $out 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   162
     echo -e "  --> ONE TEST FAILED\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   163
  fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   164
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   165
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   166
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   167
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   168
if [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   169
then
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   170
  echo " count_tours from every position on the board of dim 5 for the first 3 rows (0.5% marks)" | tee -a $out
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   171
  echo " dim = 5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56)" | tee -a $out
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   172
  START=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   173
  
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   174
  if (scala_assert_thirty "knight1.scala" "knight1_test3b.scala") 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   175
  then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   176
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   177
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   178
     #echo " This test ran for $DIFF seconds." | tee -a $out  
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   179
     echo -e "  --> success\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   180
     marks=$(( marks + 0.5 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   181
  else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   182
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   183
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   184
     echo " This test ran for $DIFF seconds." | tee -a $out 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   185
     echo -e "  --> ONE TEST FAILED\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   186
  fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   187
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   188
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   189
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   190
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   191
if [ $tsts -eq 0 ]
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   192
then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   193
  echo " enum_tours(5, List((0,2)) ) => 56 tours? and all correct?" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   194
  echo " enum_tours(5, List((0,0)) ) => 304 tours? and all correct?" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   195
  START=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   196
  
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   197
  if (scala_assert_thirty "knight1.scala" "knight1_test3c.scala") 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   198
  then
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   199
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   200
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   201
     #echo " This test ran for $DIFF seconds." | tee -a $out 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   202
     echo -e "  --> success\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   203
     marks=$(( marks + 1.0 ))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   204
  else
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   205
     END=$(date +%s)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   206
     DIFF=$(( $END - $START ))
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   207
     echo " This test ran for $DIFF seconds." | tee -a $out 
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   208
     echo -e "  --> \n ONE TEST FAILED\n" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   209
  fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   210
fi
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   211
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   212
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   213
## final marks
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   214
echo -e "Overall mark for the Preliminary Part 4 (Scala)" | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   215
printf " %0.1f\n" $marks | tee -a $out
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   216
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   217
387
6282b88511d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 386
diff changeset
   218