marking2/danube_test.sh
author Christian Urban <urbanc@in.tum.de>
Tue, 04 Feb 2020 14:15:42 +0000
changeset 331 e3878cdd38bc
parent 284 9a04eb6a2291
child 332 703c7e42bf46
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
# to make the script fail safely
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
set -euo pipefail
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
out=${1:-output}
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
     9
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    10
echo -e `date` >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    11
echo -e  "" > $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    12
echo -e  "Below is the feedback and provisional marks for your submission" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    13
echo -e  "for core assignment 7.  Please note all marks are provisional until" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    14
echo -e  "ratified by the assessment board -- this is not an official" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    15
echo -e  "results transcript." >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    16
echo -e  "" >> $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    18
# marks for core CW7
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    19
marks=$(( 0 ))
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    20
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    21
echo -e "" >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    22
echo -e  "Below is the feedback for your submission danube.scala" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    23
echo -e  "" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    24
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    25
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
# compilation tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
function scala_compile {
283
ef5f62bf5987 updated
Christian Urban <urbanc@in.tum.de>
parents: 264
diff changeset
    31
    (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out)
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
}
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
# functional tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
function scala_assert {
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    37
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
}
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
# purity test
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
function scala_vars {
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    43
   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
}
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
# var, .par return, ListBuffer test
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
#
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    49
echo -e  "danube.scala does not contain vars, returns,  Arrays, ListBuffers etc?" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
if (scala_vars danube.scala)
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
then
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    53
  echo -e  "  --> TEST FAILED\n" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    54
  tsts0=$(( 1 ))  
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    56
  echo -e  "  --> success" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  tsts0=$(( 0 )) 
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
### compilation test
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
if  [ $tsts0 -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
then 
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    65
  echo -e  "danube.scala runs?" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
  if (scala_compile danube.scala)
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    69
    echo -e  "  --> success" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
    tsts=$(( 0 ))
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    72
    echo -e  "  --> SCALA DID NOT RUN danube.scala" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
    tsts=$(( 1 )) 
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
  fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
else
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  tsts=$(( 1 ))     
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
### danube get_cvs_url tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
if [ $tsts -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    83
  echo -e  "danube.scala tests:" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    84
  echo -e  "  val movies_url = \"\"\"https://nms.kcl.ac.uk/christian.urban/movies.csv\"\"\"" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    85
  echo -e  "  get_csv_url(movies_url).length == 9742" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  if (scala_assert "danube.scala" "danube_test1.scala")
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    89
      echo -e  "  --> success" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    90
      marks=$(( marks + 1 ))
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  else
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    92
      echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
### danube processing tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
if [ $tsts -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   100
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   101
  echo -e  "  val movie_names = process_movies(movies)" | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   102
  echo -e  "  " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   103
  echo -e  "  good_ratings.length == 48580 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   104
  echo -e  "  movie_names.length == 9742 " | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  if (scala_assert "danube.scala" "danube_test2.scala") 
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   108
      echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   109
      marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   110
  else
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   111
      echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   112
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   113
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   114
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   115
### danube groupById test
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   116
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   117
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   118
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   119
  echo -e  "  val ls1 = List((\"1\", \"a\"), (\"2\", \"a\"), (\"1\", \"c\"), (\"2\", \"a\"), (\"1\", \"c\"))" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   120
  echo -e  "  val ls2 = List((\"1\", \"a\"), (\"1\", \"b\"), (\"2\", \"x\"), (\"3\", \"a\"), (\"2\", \"y\"), (\"3\", \"c\"))" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   121
  echo -e  "  groupById(ls1, Map()) == Map(1 -> List(c, c, a), 2 -> List(a, a))" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   122
  echo -e  "  groupById(ls2, Map()) == Map(1 -> List(b, a), 2 -> List(x, y), 3 -> List(c, a))" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   123
  echo -e  "      where the order in the lists is unimportant" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   124
  echo -e  "  val ls3 = (1 to 1000).map(_.toString).toList" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   125
  echo -e  "  val ls4 = ls3 zip ls3.tail" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   126
  echo -e  "  val ls5 = ls4 ::: ls4.reverse" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   127
  echo -e  "  groupById(ls5, Map()) == Map(1 -> List(2,2), 2 -> List(3,3), ....)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   128
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   129
  if (scala_assert "danube.scala" "danube_test3.scala")
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   130
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   131
      echo -e  -e "  --> success" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   132
      marks=$(( marks + 1 ))
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   134
      echo -e  -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   135
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   136
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   137
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   138
### danube favourites tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   139
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   140
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   141
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   142
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   143
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   144
  echo -e  "  favourites(ratings_map, \"912\").length  == 80 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   145
  echo -e  "  favourites(ratings_map, \"858\").length  == 158 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   146
  echo -e  "  favourites(ratings_map, \"260\").length  == 201 " | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   147
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   148
  if (scala_assert "danube.scala" "danube_test4.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   149
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   150
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   151
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   152
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   153
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   154
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   155
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   156
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   157
### danube suggestions tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   158
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   159
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   160
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   161
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   162
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   163
  echo -e  "  suggestions(ratings_map, \"912\").length  == 4110 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   164
  echo -e  "  suggestions(ratings_map, \"858\").length  == 4883 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   165
  echo -e  "  suggestions(ratings_map, \"260\").length  == 4970 " | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   166
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   167
  if (scala_assert "danube.scala" "danube_test5.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   168
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   169
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   170
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   171
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   172
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   173
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   174
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   175
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   176
### danube recommendation tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   177
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   178
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   179
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   180
  echo -e  "  recommendations(ratings_map, movies_map, \"1\").length  == 2 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   181
  echo -e  "  recommendations(ratings_map, movies_map, \"2\").length  == 2 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   182
  echo -e  "  recommendations(ratings_map, movies_map, \"3\").length  == 2 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   183
  echo -e  "  recommendations(ratings_map, movies_map, \"4\").length  == 0 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   184
  echo -e  "  recommendations(ratings_map, movies_map, \"5\").length  == 2 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   185
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   186
  if (scala_assert "danube.scala" "danube_test6.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   187
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   188
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   189
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   190
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   191
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
  fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   195
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   196
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   197
## final marks
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   198
echo -e "" >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   199
echo -e  "Overall mark for CW 7 Core Part" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   200
echo -e  "$marks" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   201
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   202