main_testing4/shogun_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 15 Sep 2024 12:57:59 +0100
changeset 493 244df77507c2
parent 477 a4e1f63157d8
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
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
     8
echo -e "Below is the feedback for your submission of shogun.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
# compilation tests
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
function scala_compile {
493
244df77507c2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 477
diff changeset
    21
  (scala-cli compile -color never -Xprint:parser "$1" 2> c$out 1> c$out)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
# functional tests
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    26
function scala_assert {
493
244df77507c2 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 477
diff changeset
    27
  (scala-cli --server=false --java-opt -Xmx1g -i project.scala "$1" "$2" -e "urbanmain()" 2> /dev/null 1> /dev/null)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
}
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
# purity test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
function scala_vars {
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    32
   (sed 's/immutable/ok/g' c$out > cb$out;
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    33
    egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
}
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
# compilation test
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    39
  
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    40
echo -e "shogun.scala runs?" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    42
if (scala_compile shogun.scala)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    43
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    44
    echo -e "  --> passed" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    tsts1=$(( 0 ))
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  else
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    47
    echo -e "  --> SCALA DID NOT RUN SHOGUN.SCALA\n" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    tsts1=$(( 1 )) 
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    51
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    52
# shogun: purity test
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    53
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    54
if [ $tsts1 -eq 0 ]
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    55
then  
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    56
    echo -e "shogun.scala does not contain vars, returns etc?" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    57
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    58
    if (scala_vars shogun.scala)
347
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 "  --> 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
    61
	tsts1=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    62
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    63
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    64
	tsts1=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    65
    fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    66
fi    
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    67
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 329
diff changeset
    68
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    69
### shogun eval test
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    71
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    72
then
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    73
    echo -e "  val pw_a = Pawn(4, Wht, (4,4)) " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    74
    echo -e "  eval(pw_a, U,  4, b_init) == Set(Pawn(4,Wht,(4,8)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    75
    echo -e "  eval(pw_a, U,  3, b_init) == Set(Pawn(4,Wht,(4,7)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    76
    echo -e "  eval(pw_a, RU, 4, b_init) == Set(Pawn(4,Wht,(6,6)), Pawn(4,Wht,(4,8)), " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    77
    echo -e "                                   Pawn(4,Wht,(5,7)), Pawn(4,Wht,(7,5)), " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    78
    echo -e "                                   Pawn(4,Wht,(8,4)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    79
    echo -e "  " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    80
    echo -e "  val pw_b = Pawn(4, Red, (4,4))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    81
    echo -e "  eval(pw_b, RU, 4, b_init) == Set(Pawn(4,Red,(8,4)), Pawn(4,Red,(7,5)), " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    82
    echo -e "                                   Pawn(4,Red,(6,6)), Pawn(4,Red,(5,7)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    83
    echo -e "  " >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    84
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    85
    if (scala_assert "shogun.scala" "shogun_test1.scala")
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    86
    then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    87
        echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    88
    else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    89
        echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    90
    fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    91
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    93
### shogun all_moves test
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    95
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
    96
then
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    97
  echo -e " val pw_c = Pawn(2, Wht, (4,4))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    98
  echo -e " val pw_d = Pawn(3, Red, (4,4))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
    99
  echo -e " all_moves(pw_c, b_init) == " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   100
  echo -e "    Set(Pawn(2,Wht,(3,5)), Pawn(2,Wht,(2,4)), Pawn(2,Wht,(3,3)), Pawn(2,Wht,(5,5))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   101
  echo -e "        Pawn(2,Wht,(6,4)), Pawn(2,Wht,(4,6)), Pawn(2,Wht,(4,2)), Pawn(2,Wht,(5,3)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   102
  echo -e " all_moves(pw_d, b_init) == " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   103
  echo -e "    Set(Pawn(3,Red,(4,7)), Pawn(3,Red,(5,2)), Pawn(3,Red,(3,2)), Pawn(3,Red,(1,4))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   104
  echo -e     "    Pawn(3,Red,(6,3)), Pawn(3,Red,(3,6)), Pawn(3,Red,(2,5)), Pawn(3,Red,(2,3)), " >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   105
  echo -e "        Pawn(3,Red,(4,1)), Pawn(3,Red,(5,6)), Pawn(3,Red,(7,4)), Pawn(3,Red,(6,5))))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   106
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   107
  
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   108
  if (scala_assert "shogun.scala" "shogun_test2.scala")
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   109
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   110
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   111
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   112
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   113
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   114
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   117
### attacked test
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   119
if [ $tsts1 -eq 0 ]
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   120
then
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   121
  echo -e " val b2 = Board(Set(King(2, Red, (4,2)), King(2, Wht, (7,1))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   122
  echo -e "                    Pawn(3, Red, (6,1)), Pawn(2, Wht, (8,4))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   123
  echo -e "                    Pawn(4, Red, (4,4)), Pawn(2, Wht, (4,1))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   124
  echo -e "                    Pawn(4, Red, (5,3)), Pawn(3, Wht, (8,7))," >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   125
  echo -e "                    Pawn(3, Red, (6,5))))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   126
  echo -e " attacked(Red, b2) == Set(Pawn(2,Wht,(8,4)), King(2,Wht,(7,1)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   127
  echo -e " attacked(Wht, b2) == Set(Pawn(3,Red,(6,1)))" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   128
  echo -e " attacked(Wht, b_init) == Set()" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   129
  echo -e " attacked(Red, b_init) == Set()" >> $out
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   130
  
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   131
  if (scala_assert "shogun.scala" "shogun_test3.scala")
433
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   132
  then
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   133
    echo -e "  --> success" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   134
  else
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   135
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   136
  fi
6af86ba1208f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 418
diff changeset
   137
fi
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   139
### attackedN test
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
if [ $tsts1 -eq 0 ]
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
then
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   143
  echo -e " attackedN(Pawn(2, Wht, (8,4)), b2) == 3" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   144
  echo -e " attackedN(King(2, Wht, (7,1)), b2) == 1" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   145
  echo -e " attackedN(Pawn(3, Red, (6,1)), b2) == 1" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   147
  if (scala_assert "shogun.scala" "shogun_test4.scala") 
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  then
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
    echo -e "  --> success" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  else
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   156
### protectedN test
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
if [ $tsts1 -eq 0 ]
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
then
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   160
  echo -e " protectedN(Pawn(2, Wht, (8,4)), b2) == 1" >> $out
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   161
  echo -e " protectedN(Pawn(4, Red, (5,3)), b2) == 3" >> $out
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 463
diff changeset
   163
  if (scala_assert "shogun.scala" "shogun_test5.scala") 
220
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
  then
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
    echo -e "  --> success" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
  else
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
    echo -e "  --> \n ONE TEST FAILED\n" >> $out
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
  fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
fi
3020f8c76baa updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   171
477
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   172
# legal moves
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   173
if [ $tsts1 -eq 0 ]
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   174
then
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   175
  echo -e " Task 6: automated test cases not yet done" >> $out
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   176
fi
a4e1f63157d8 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 476
diff changeset
   177
296
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   178
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   179
echo -e "" >> $out
12dc251fc47e updated
Christian Urban <urbanc@in.tum.de>
parents: 295
diff changeset
   180