marking2/danube_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Tue, 07 Dec 2021 23:17:51 +0000
changeset 418 fa7f7144f2bb
parent 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 {
332
703c7e42bf46 updated
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
    43
   (egrep '\bvar\b|\breturn\b|ListBuffer|new Array' "$1" 2> /dev/null 1> /dev/null)
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
}
332
703c7e42bf46 updated
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
    45
#function scala_vars {
703c7e42bf46 updated
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
    46
#   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
703c7e42bf46 updated
Christian Urban <urbanc@in.tum.de>
parents: 331
diff changeset
    47
#}
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
# var, .par return, ListBuffer test
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
#
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    52
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
    53
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
if (scala_vars danube.scala)
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
then
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    56
  echo -e  "  --> TEST FAILED\n" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    57
  tsts0=$(( 1 ))  
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    59
  echo -e  "  --> success" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  tsts0=$(( 0 )) 
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
### compilation test
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
if  [ $tsts0 -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
then 
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    68
  echo -e  "danube.scala runs?" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
  if (scala_compile danube.scala)
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    72
    echo -e  "  --> success" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
    tsts=$(( 0 ))
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    75
    echo -e  "  --> SCALA DID NOT RUN danube.scala" | tee -a $out
227
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
else
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  tsts=$(( 1 ))     
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
### danube get_cvs_url tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
if [ $tsts -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    86
  echo -e  "danube.scala tests:" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    87
  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
    88
  echo -e  "  get_csv_url(movies_url).length == 9742" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  if (scala_assert "danube.scala" "danube_test1.scala")
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    92
      echo -e  "  --> success" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    93
      marks=$(( marks + 1 ))
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  else
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    95
      echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
### danube processing tests
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
if [ $tsts -eq 0 ]
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   103
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   104
  echo -e  "  val movie_names = process_movies(movies)" | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   105
  echo -e  "  " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   106
  echo -e  "  good_ratings.length == 48580 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   107
  echo -e  "  movie_names.length == 9742 " | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
  if (scala_assert "danube.scala" "danube_test2.scala") 
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   111
      echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   112
      marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   113
  else
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   114
      echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   115
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   116
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   117
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   118
### danube groupById test
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   119
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   120
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   121
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   122
  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
   123
  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
   124
  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
   125
  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
   126
  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
   127
  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
   128
  echo -e  "  val ls4 = ls3 zip ls3.tail" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   129
  echo -e  "  val ls5 = ls4 ::: ls4.reverse" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   130
  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
   131
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   132
  if (scala_assert "danube.scala" "danube_test3.scala")
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   133
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   134
      echo -e  -e "  --> success" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   135
      marks=$(( marks + 1 ))
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   137
      echo -e  -e "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   138
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   139
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   140
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   141
### danube favourites tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   142
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   143
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   144
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   145
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   146
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   147
  echo -e  "  favourites(ratings_map, \"912\").length  == 80 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   148
  echo -e  "  favourites(ratings_map, \"858\").length  == 158 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   149
  echo -e  "  favourites(ratings_map, \"260\").length  == 201 " | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   150
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   151
  if (scala_assert "danube.scala" "danube_test4.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   152
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   153
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   154
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   155
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   156
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   157
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   158
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   159
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   160
### danube suggestions tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   161
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   162
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   163
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   164
  echo -e  "  val good_ratings = process_ratings(ratings)" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   165
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   166
  echo -e  "  suggestions(ratings_map, \"912\").length  == 4110 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   167
  echo -e  "  suggestions(ratings_map, \"858\").length  == 4883 " | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   168
  echo -e  "  suggestions(ratings_map, \"260\").length  == 4970 " | tee -a $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   169
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   170
  if (scala_assert "danube.scala" "danube_test5.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   171
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   172
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   173
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   174
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   175
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   176
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   177
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   178
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   179
### danube recommendation tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   180
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   181
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   182
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   183
  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
   184
  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
   185
  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
   186
  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
   187
  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
   188
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   189
  if (scala_assert "danube.scala" "danube_test6.scala") 
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   190
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   191
    echo -e  "  --> success" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   192
    marks=$(( marks + 1 ))
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   193
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   194
    echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
227
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
  fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
fi
b5f3e814a710 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   198
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   199
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   200
## final marks
331
e3878cdd38bc updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   201
echo -e "" >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   202
echo -e  "Overall mark for CW 7 Core Part" | tee -a $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   203
echo -e  "$marks" | tee -a $out
264
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   204
ecd989eee8bd updated
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
   205