main_testing2/danube_test7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 22 Jan 2021 10:35:50 +0000
changeset 387 6282b88511d8
parent 384 6e1237691307
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
379
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
import CW7b._
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
384
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
     4
val urban_recs = 
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
     5
  Map("1" -> List("b", "a"), 
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
     6
      "2" -> List("y", "x"), 
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
     7
      "3" -> List("a", "c"))
379
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
384
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
     9
val urban_names = Map("a" -> "A", "b" -> "B", "c" -> "C", "x" -> "X", "y" -> "Y")
379
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
384
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
    11
assert(most_recommended(urban_recs, urban_names).toSet ==
6e1237691307 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 379
diff changeset
    12
        Set(("A",2), ("B",1), ("C",1), ("X",1), ("Y",1)))
379
5616b45d656f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13