main_testing4/knight_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Tue, 08 Nov 2022 18:35:41 +0000
changeset 434 8c5804b2f9d2
parent 433 6af86ba1208f
child 463 0315d9983cd0
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
set -euo pipefail
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
out=${1:-output}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
echo -e "" > $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
418
fa7f7144f2bb updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
     8
echo -e "Below is the feedback for your submission of knight{1,2,3}.scala" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
echo -e "" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    10
#echo -e "!! Important: !!" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    11
#echo -e "Because of limitations with our testing infrastructure, we can only" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    12
#echo -e "let code run for 10 seconds and then have to kill it. This might" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    13
#echo -e "mean your code is correct, but still marked as Fail. Remember" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    14
#echo -e "you can test your code on your own machine and benchmark it" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    15
#echo -e "against the reference implementation." >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    16
#echo -e "" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    17
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
# compilation tests
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
function scala_compile {
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    22
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
# functional tests
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    27
function scala_assert {
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    28
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
# purity test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
function scala_vars {
376
6cc36d0ef79e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 352
diff changeset
    34
   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
# compilation test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    43
  
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    44
echo -e "knight1.scala runs?" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    46
if (scala_compile knight1.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    47
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    48
    echo -e "  --> passed" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    tsts1=$(( 0 ))
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  else
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
    echo -e "  --> SCALA DID NOT RUN KNIGHT1.SCALA\n" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
    tsts1=$(( 1 )) 
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    55
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    56
# knights1: purity test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    57
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    58
if [ $tsts1 -eq 0 ]
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    59
then  
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    60
    echo -e "knight1.scala does not contain vars, returns etc?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    61
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    62
    if (scala_vars knight1.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    63
    then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    64
	echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out  
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    65
	tsts1=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    66
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    67
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    68
	tsts1=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    69
    fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    70
fi    
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    71
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    72
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
### knight1 test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    75
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    76
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    77
    #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    78
    echo -e " is_legal(8, Nil, (3, 4)) == true " >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    79
    echo -e " is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false " >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    80
    echo -e " is_legal(2, Nil, (0, 0)) == true" >> $out                          
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    81
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    82
    if (scala_assert "knight1.scala" "knight_test1.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    83
    then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    84
        echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    85
    else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    86
        echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    87
    fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    88
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
### knight2 test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    92
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    93
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    94
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    95
  echo -e " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    96
  echo -e " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    97
  echo -e " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    98
  echo -e " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    99
  echo -e " legal_moves(1, Nil, (0,0)) == Nil" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   100
  echo -e " legal_moves(2, Nil, (0,0)) == Nil" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   101
  echo -e " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   102
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   103
  if (scala_assert "knight1.scala" "knight_test2.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   104
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   105
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   106
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   107
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   108
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   109
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
### knight3 test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   114
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   115
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   116
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   117
  echo -e " count_tours from every position on the board" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   118
  echo -e " dim = 1: 1" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   119
  echo -e "       2: 0,0,0,0" >>  $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   120
  echo -e "       3: 0,0,0,0,0,0,0,0,0" >>  $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   121
  echo -e "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   122
  #echo -e "       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" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   123
  echo -e " enum_tours(5, List((0,0)) ) == 304 and all correct?" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   124
  echo -e " enum_tours(5, List((0,1)) ) == 0" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   125
  echo -e " enum_tours(5, List((0,2)) ) == 56 and all correct?" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   126
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   127
  if (scala_assert "knight1.scala" "knight_test3.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   128
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   129
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   130
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   131
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   132
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   133
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
### knight4 test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
if [ $tsts1 -eq 0 ]
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   139
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
  echo -e " Let f = (x:(Int, Int)) => if (x._1 > 3) Some(List(x)) else None " >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
  echo -e "   first(List((1,0),(2,0),(3,0),(4,0)), f) == Some(List((4,0)))" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
  echo -e "   first(List((1,0),(2,0),(3,0)), f) == None" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   144
  if (scala_assert "knight1.scala" "knight_test4.scala") 
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
  then
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
    echo -e "  --> success" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  else
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
  fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
### knight5 test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
if [ $tsts1 -eq 0 ]
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   157
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
  echo -e " is first_tour(6, List((0, 0))) ok? " >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  echo -e " is first_tour(4, List((0, 0))) == None " >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   161
  if (scala_assert "knight1.scala" "knight_test5.scala") 
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
  then
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
    echo -e "  --> success" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
  else
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
  fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   169
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   170
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   171
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   172
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   173
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   174
# compilation test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   175
echo -e "knight2.scala runs?" >> $out
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   176
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   177
if (scala_compile knight2.scala)
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   178
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
   179
    echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   180
    tsts2=$(( 0 ))
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   181
else
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   182
    echo -e "  --> SCALA DID NOT RUN KNIGHT2.SCALA\n" >> $out  
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   183
    tsts2=$(( 1 )) 
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   184
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   185
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   186
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   187
# knights2: purity test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   188
#
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   189
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   190
if [ $tsts2 -eq 0 ]
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   191
then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   192
    echo -e "knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?" >> $out
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   193
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   194
    if (scala_vars knight2.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   195
    then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   196
	echo -e "  --> Fail (make triple-sure your program conforms to the required format)" >> $out    
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   197
	tsts2=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   198
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
   199
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   200
	tsts2=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   201
    fi
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   202
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   203
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   204
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   205
# ordered move test
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   206
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   207
if [ $tsts2 -eq 0 ]
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   208
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   209
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out  
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   210
  echo -e " ordered_moves(8, List((3,4), (3,2)), (1,3)) == List((0,1), (0,5), (2,1), (2,5))" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   211
  echo -e " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   212
  echo -e " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   213
  
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   214
  if (scala_assert "knight2.scala" "knight_test6.scala")
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   215
  then
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   216
      echo -e "  --> success" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   217
  else
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   218
      echo -e "  --> \n ONE TEST FAILED\n" >> $out  
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   219
  fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   220
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   221
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   222
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   223
# first-closed-tour test
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   224
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   225
if [ $tsts2 -eq 0 ]
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   226
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   227
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out  
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 296
diff changeset
   228
  echo -e " first_closed_tour_heuristics(6, List((3,3))) found and correct?" >> $out
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   229
  
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   230
  if (scala_assert "knight2.scala" "knight_test7.scala")
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   231
  then
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   232
      echo -e "  --> success" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   233
  else
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   234
      echo -e "  --> \n ONE TEST FAILED\n" >> $out  
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   235
  fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   236
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   237
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   238
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   239
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   240
if [ $tsts2 -eq 0 ]
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   241
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   242
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out   
329
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 296
diff changeset
   243
  echo -e " first_tour_heuristics(8, List((0,0))) found and correct?" >> $out
8a34b2ebc8cc updated
Christian Urban <urbanc@in.tum.de>
parents: 296
diff changeset
   244
  echo -e " first_tour_heuristics(30, List((0,0))) found and correct?" >> $out
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   245
  
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   246
  if (scala_assert "knight2.scala" "knight_test8.scala")
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   247
  then
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   248
      echo -e "  --> success" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   249
  else
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   250
      echo -e "  --> \n ONE TEST FAILED\n" >> $out 
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   251
  fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   252
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   253
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   254
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   255
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   256
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   257
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   258
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   259
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   260
# compilation test
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   261
   
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   262
echo "knight3.scala runs?" >> $out
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   263
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   264
if (scala_compile knight3.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   265
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
   266
    echo "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   267
    tsts3=$(( 0 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   268
else
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   269
    echo -e "  --> SCALA DID NOT RUN KNIGHT3.SCALA\n" >> $out  
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   270
    tsts3=$(( 1 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   271
fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   272
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   273
# knights3: purity test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   274
#
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   275
if  [ $tsts3 -eq 0 ]
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   276
then 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   277
    echo -e "knight3.scala does not contain vars, returns, Arrays, ListBuffers etc?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   278
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   279
    if (scala_vars knight3.scala)
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   280
    then
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   281
	echo "  --> Fail (make triple-sure your program conforms to the required format)" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   282
	tsts3=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   283
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
   284
	echo "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   285
	tsts3=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   286
    fi
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   287
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   288
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   289
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   290
if [ $tsts3 -eq 0 ]
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   291
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   292
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out  
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   293
  echo -e " tour_on_mega_board(70, List((0,0))) found and correct?" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   294
  
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
   295
  if (scala_assert "knight3.scala" "knight_test9.scala")
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   296
  then
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   297
      echo -e "  --> success" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   298
  else
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   299
      echo -e "  --> \n ONE TEST FAILED\n" >> $out 
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   300
  fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   301
fi
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   302
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   303
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   304
echo -e "" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   305
echo -e "" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   306
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   307
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   308
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   309
# compilation test
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   310
   
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   311
echo "knight4.scala runs?" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   312
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   313
if (scala_compile knight4.scala)
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   314
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   315
    echo "  --> passed" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   316
    tsts4=$(( 0 ))
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   317
else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   318
    echo -e "  --> SCALA DID NOT RUN KNIGHT4.SCALA\n" >> $out  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   319
    tsts4=$(( 1 )) 
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   320
fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   321
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   322
# knights4: purity test
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   323
#
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   324
if  [ $tsts4 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   325
then 
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   326
    echo -e "knight4.scala does not contain vars, returns, Arrays, ListBuffers etc?" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   327
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   328
    if (scala_vars knight4.scala)
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   329
    then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   330
	echo "  --> Fail (make triple-sure your program conforms to the required format)" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   331
	tsts4=$(( 1 ))
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   332
    else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   333
	echo "  --> passed" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   334
	tsts4=$(( 0 )) 
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   335
    fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   336
fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   337
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   338
if [ $tsts4 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   339
then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   340
  #echo -e "For testing needs to take 10 seconds or less to execute: " >> $out  
434
8c5804b2f9d2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 433
diff changeset
   341
  echo -e " one_tour_pred(8, List((0, 0)), 40, x => x._1 < 5) is ok?" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   342
  
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   343
  if (scala_assert "knight4.scala" "knight_test10.scala")
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   344
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   345
      echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   346
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   347
      echo -e "  --> \n ONE TEST FAILED\n" >> $out 
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   348
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   349
fi