main_testing2/danube_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 11 Mar 2023 23:24:15 +0000
changeset 469 48de09728447
parent 424 daf561a83ba6
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
# to make the script fail safely
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
set -euo pipefail
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
     7
424
Christian Urban <christian.urban@kcl.ac.uk>
parents: 423
diff changeset
     8
scalafile=${1:-danube.scala}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 423
diff changeset
     9
out=${2:-output}
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    10
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    11
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
echo "" > $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
echo "Below is the feedback for your submission danube.scala" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
echo "" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
# compilation tests
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
function scala_compile {
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    22
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
}
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
# functional tests
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
function scala_assert {
424
Christian Urban <christian.urban@kcl.ac.uk>
parents: 423
diff changeset
    28
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
}
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
# purity test
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
function scala_vars {
376
6cc36d0ef79e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 352
diff changeset
    34
   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
}
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    38
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    39
### compilation test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    40
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    41
echo "danube.scala runs?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    42
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    43
if (scala_compile $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    44
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    45
    echo "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    46
    tsts=$(( 0 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    47
else
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    48
    echo "  --> SCALA DID NOT RUN danube.scala" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    49
    tsts=$(( 1 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    50
fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    51
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
# var, .par return, ListBuffer test
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
#
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    55
if [ $tsts -eq 0 ]
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    57
    echo "danube.scala does not contain vars, returns etc?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    58
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    59
    if (scala_vars $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    60
    then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    61
	echo "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    62
	tsts=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    63
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    64
	echo "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    65
	tsts=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 284
diff changeset
    66
    fi
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
fi
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
### danube get_cvs_url tests
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
if [ $tsts -eq 0 ]
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
then
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
  echo "danube.scala tests:" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
  echo "  val movies_url = \"\"\"https://nms.kcl.ac.uk/christian.urban/movies.csv\"\"\"" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  echo "  get_csv_url(movies_url).length == 9742" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    78
  if (scala_assert $scalafile "danube_test1.scala")
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    80
    echo -e "  --> success" >> $out
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
    82
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  fi
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
fi
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
### danube processing tests
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
if [ $tsts -eq 0 ]
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
then
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  echo "  val good_ratings = process_ratings(ratings)" >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  echo "  val movie_names = process_movies(movies)" >> $out  
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  echo "  " >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  echo "  good_ratings.length == 48580 " >> $out
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  echo "  movie_names.length == 9742 " >> $out
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    95
  echo "  " >> $out
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    96
  echo "  val r_elems = List((\"1\",\"1\"), (\"1\",\"3\"), (\"1\",\"6\"), (\"1\",\"47\")) " >> $out
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    97
  echo "  r_elems.forall(good_ratings.contains(_)) == true" >> $out
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
    99
  if (scala_assert $scalafile "danube_test2.scala") 
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  then
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   101
    echo -e "  --> success" >> $out
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  else
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   103
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   104
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   105
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   106
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   107
### danube groupById test
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   108
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   109
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   110
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   111
  echo -e  "  val ls1 = List((\"1\", \"a\"), (\"2\", \"a\"), (\"1\", \"c\"), (\"2\", \"a\"), (\"1\", \"c\"))" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   112
  echo -e  "  val ls2 = List((\"1\", \"a\"), (\"1\", \"b\"), (\"2\", \"x\"), (\"3\", \"a\"), (\"2\", \"y\"), (\"3\", \"c\"))" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   113
  echo -e  "  groupById(ls1, Map()) == Map(1 -> List(c, c, a), 2 -> List(a, a))" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   114
  echo -e  "  groupById(ls2, Map()) == Map(1 -> List(b, a), 2 -> List(x, y), 3 -> List(c, a))" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   115
  echo -e  "      where the order in the lists is unimportant" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   116
  echo -e  "  val ls3 = (1 to 1000).map(_.toString).toList" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   117
  echo -e  "  val ls4 = ls3 zip ls3.tail" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   118
  echo -e  "  val ls5 = ls4 ::: ls4.reverse" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   119
  echo -e  "  groupById(ls5, Map()) == Map(1 -> List(2,2), 2 -> List(3,3), ....)" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   120
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   121
  if (scala_assert $scalafile "danube_test3.scala")
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   122
  then
403
ffce7b61b446 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 389
diff changeset
   123
      echo -e "  --> success" >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   124
  else
403
ffce7b61b446 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 389
diff changeset
   125
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
211
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
  fi
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
fi
092e0879a5ae updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   129
### danube favourites tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   130
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   131
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   132
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   133
  echo -e  "  val good_ratings = process_ratings(ratings)" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   134
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   135
  echo -e  "  favourites(ratings_map, \"912\").length  == 80 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   136
  echo -e  "  favourites(ratings_map, \"858\").length  == 158 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   137
  echo -e  "  favourites(ratings_map, \"260\").length  == 201 " >> $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   138
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   139
  if (scala_assert $scalafile "danube_test4.scala") 
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   140
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   141
    echo -e  "  --> success" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   142
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   143
    echo -e  "  --> ONE OF THE TESTS FAILED\n" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   144
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   145
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   146
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   147
### danube suggestions tests
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   148
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   149
if [ $tsts -eq 0 ]
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   150
then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   151
  echo -e  "  val good_ratings = process_ratings(ratings)" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   152
  echo -e  "  val ratings_map = groupById(good_ratings, Map())" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   153
  echo -e  "  suggestions(ratings_map, \"912\").length  == 4110 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   154
  echo -e  "  suggestions(ratings_map, \"858\").length  == 4883 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   155
  echo -e  "  suggestions(ratings_map, \"260\").length  == 4970 " >> $out  
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   156
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   157
  if (scala_assert $scalafile "danube_test5.scala") 
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   158
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   159
    echo -e  "  --> success" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   160
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   161
    echo -e  "  --> ONE OF THE TESTS FAILED\n" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   162
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   163
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   164
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   165
### danube recommendation tests
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 [ $tsts -eq 0 ]
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  "  recommendations(ratings_map, movies_map, \"1\").length  == 2 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   170
  echo -e  "  recommendations(ratings_map, movies_map, \"2\").length  == 2 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   171
  echo -e  "  recommendations(ratings_map, movies_map, \"3\").length  == 2 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   172
  echo -e  "  recommendations(ratings_map, movies_map, \"4\").length  == 0 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   173
  echo -e  "  recommendations(ratings_map, movies_map, \"5\").length  == 2 " >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   174
422
217bbd700594 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 403
diff changeset
   175
  if (scala_assert $scalafile "danube_test6.scala") 
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   176
  then
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   177
    echo -e  "  --> success" >> $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   178
  else
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   179
    echo -e  "  --> ONE OF THE TESTS FAILED\n" >>  $out
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   180
  fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   181
fi
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 283
diff changeset
   182
379
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   183
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   184