marking/mark02
author Christian Urban <urbanc@in.tum.de>
Sat, 16 Jun 2018 00:07:32 +0100
changeset 182 d3d912d7e17f
parent 102 085bf16963c6
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
set -e
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
out=${1:-output}
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
echo "" > $out
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
echo "Below is the feedback and provisional mark for your submission" >> $out
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
     9
echo "for CW 7, Part 1.  Please note all marks are provisional until" >> $out
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
echo "ratified by the assessment board -- this is not an official" >> $out
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
echo "results transcript." >> $out
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
echo "" >> $out
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    14
function scala_vars {
102
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
    15
   (egrep 'var|return|ListBuffer|mutable' "$1" 2> /dev/null 1> /dev/null)
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    16
}
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
# compilation tests
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
function scala_compile {
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    22
  (scala "$1" 2> /dev/null 1> /dev/null) 
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
}
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
# functional tests
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
function scala_assert {
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  (scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
}
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    33
# marks for CW2
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
marks=$(( 0 ))
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    36
# knights1: var, comments test
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    37
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    38
echo "knight1.scala does not contain vars, returns etc?" | tee -a $out
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    40
if (scala_vars knight1.scala)
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
then
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    42
  echo "  --> fail" | tee -a $out
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    43
  tsts0=$(( 1 ))
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
else
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    45
  echo "  --> yes" | tee -a $out
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    46
  tsts0=$(( 0 )) 
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
fi
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
    50
# compilation test
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    51
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    52
if [ $tsts0 -eq 0 ]
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    53
then    
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    54
  echo "knight1.scala runs?" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    55
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    56
  if (scala_compile knight1.scala.bak)
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    57
  then
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    58
    echo "  --> yes" | tee -a $out
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    59
    tsts1=$(( 0 ))
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    60
  else
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    61
    echo "  --> scala did not run knight1.scala" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    62
    tsts1=$(( 1 )) 
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    63
  fi
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    64
else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    65
  tsts1=$(( 1 ))   
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    66
fi
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    67
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    68
### knight1a test
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    70
if [ $tsts1 -eq 0 ]
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    71
then
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    72
    echo " is_legal(8, Nil) (3,4) == true " | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    73
    echo " is_legal(8, (4,1) (1,0)) (4,1) == false " | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    74
    echo " is_legal(2, Nil) (0,0) == true" | tee -a $out                          
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    75
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    76
    if (scala_assert "knight1.scala.bak" "../../../marking/knight1c_test.scala")
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    77
    then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    78
        echo "  --> success" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    79
        marks=$(( marks + 1 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    80
    else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    81
        echo "  --> test failed" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    82
    fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    83
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    84
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    85
if [ $tsts1 -eq 0 ]
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    86
then
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    87
  echo " legal_moves(8, Nil, (2,2)) = (3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    88
  echo " legal_moves(8, Nil, (7,7)) = (6,5), (5,6)" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    89
  echo " legal_moves(8, (4,1), (1,0), (2,2)) = (3,4), (4,3), (3,0), (0,1), (0,3), (1,4)" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    90
  echo " legal_moves(8, (6,6), (7,7)) = (6,5), (5,6)" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    91
  echo " legal_moves(1, Nil, (0,0)) = Nil" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    92
  echo " legal_moves(2, Nil, (0,0)) = Nil" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    93
  echo " legal_moves(3, Nil, (0,0)) = (1,2), (2,1)" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    94
  
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
    95
  if (scala_assert "knight1.scala.bak" "../../../marking/knight1_test.scala")
85
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    96
  then
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    97
    echo "  --> success" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    98
    marks=$(( marks + 1 ))
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
    99
  else
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
   100
    echo "  --> test failed" | tee -a $out
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
   101
  fi
fd3f8581ce85 updated
Christian Urban <urbanc@in.tum.de>
parents: 84
diff changeset
   102
fi
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   104
### knight1b test
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   105
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   106
if [ $tsts1 -eq 0 ]
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   107
then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   108
  echo " all_tours from every position on the board" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   109
  echo " dim = 1: 1" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   110
  echo "       2: 0,0,0,0" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   111
  echo "       3: 0,0,0,0,0,0,0,0,0" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   112
  echo "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   113
  echo "       5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   114
  echo " enum_tours(5, (0,2) ) = 56 and all correct?" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   115
  
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   116
  if (scala_assert "knight1.scala.bak" "../../../marking/knight1b_test.scala") 
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   117
  then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   118
    echo "  --> success" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   119
    marks=$(( marks + 2 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   120
  else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   121
    echo "  --> test failed" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   122
  fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   123
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   124
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   125
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   126
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   127
# knights2: var, comments test
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   128
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   129
echo "knight2.scala does not contain vars, returns etc?" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   130
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   131
if (scala_vars knight2.scala)
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   132
then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   133
  echo "  --> fail" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   134
  tsts0=$(( 1 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   135
else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   136
  echo "  --> yes" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   137
  tsts0=$(( 0 )) 
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   138
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   139
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   140
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   141
# compilation test
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   142
if  [ $tsts0 -eq 0 ]
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   143
then    
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   144
  echo "knight2.scala runs?" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   145
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   146
  if (scala_compile knight2.scala.bak)
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   147
  then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   148
    echo "  --> yes" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   149
    tsts1=$(( 0 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   150
  else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   151
    echo "  --> scala did not run knight2.scala" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   152
    tsts1=$(( 1 )) 
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   153
  fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   154
else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   155
  tsts1=$(( 1 ))     
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   156
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   157
84
8b132f8de8c7 updated
Christian Urban <urbanc@in.tum.de>
parents: 83
diff changeset
   158
### knight2 test
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
86
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   160
if [ $tsts1 -eq 0 ]
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   161
then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   162
  echo " Let f = (x:(Int, Int)) => if (x._1 > 3) Some(List(x)) else None " | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   163
  echo "  first((1,0),(2,0),(3,0),(4,0), f) == Some(List((4,0)))" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   164
  echo "  first((1,0),(2,0),(3,0), f) == None" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   165
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   166
  if (scala_assert "knight2.scala.bak" "../../../marking/knight2_test.scala") 
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   167
  then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   168
    echo "  --> success" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   169
    marks=$(( marks + 1 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   170
  else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   171
    echo "  --> test failed" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   172
  fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   173
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   174
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   175
### knight2b test
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   176
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   177
if [ $tsts1 -eq 0 ]
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   178
then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   179
  echo " is first_tour(8,  (0, 0)) ok? " | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   180
  echo " is first_tour(4,  (0, 0)) == None " | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   181
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   182
  if (scala_assert "knight2.scala.bak" "../../../marking/knight2b_test.scala") 
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   183
  then
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   184
    echo "  --> success" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   185
    marks=$(( marks + 2 ))
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   186
  else
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   187
    echo "  --> test failed" | tee -a $out
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   188
  fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   189
fi
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   190
f8a781322499 updated
Christian Urban <urbanc@in.tum.de>
parents: 85
diff changeset
   191
102
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   192
# knights3: var, comments test
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   193
#
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   194
#echo "knight3.scala does not contain vars, returns etc?" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   195
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   196
#if (scala_vars knight3.scala)
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   197
#then
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   198
#  echo "  --> fail" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   199
#  tsts0=$(( 1 ))
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   200
#else
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   201
#  echo "  --> success" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   202
#  tsts0=$(( 0 )) 
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   203
#fi
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   204
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   205
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   206
# compilation test
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   207
#if  [ $tsts0 -eq 0 ]
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   208
#then    
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   209
#  echo "knight3.scala runs?" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   210
#
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   211
#  if (scala_compile knight3.scala.bak)
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   212
#  then
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   213
#    echo "  --> success" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   214
#    tsts1=$(( 0 ))
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   215
#  else
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   216
#    echo "  --> scala did not run knight3.scala" | tee -a $out
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   217
#    tsts1=$(( 1 )) 
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   218
#  fi
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   219
#else
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   220
#  tsts1=$(( 1 ))     
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   221
#fi
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   222
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   223
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
## final marks
102
085bf16963c6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 96
diff changeset
   225
echo "Overall mark for CW 2, Part 1 " | tee -a $out
82
28c8e17ab83a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
echo "$marks" | tee -a $out