Skip to content

Commit

Permalink
modified: pkg/inst/tests/test_rdd.R
Browse files Browse the repository at this point in the history
  • Loading branch information
hqzizania committed Feb 4, 2015
1 parent a95823e commit 4914091
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/inst/tests/test_rdd.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,22 @@ test_that("fullOuterJoin() on pairwise RDDs", {
expect_equal(sortKeyValueList(actual),
sortKeyValueList(list(list("a", list(1, NULL)), list("b", list(2, NULL)), list("d", list(NULL, 4)), list("c", list(NULL, 3)))))
})

test_that("collectAsMap() on a pairwise RDD", {
rdd <- parallelize(sc, list(list(1, 2), list(3, 4)))
vals <- collectAsMap(rdd)
expect_equal(vals, list(`1` = 2, `3` = 4))

rdd <- parallelize(sc, list(list("a", 1), list("b", 2)))
vals <- collectAsMap(rdd)
expect_equal(vals, list(a = 1, b = 2))

rdd <- parallelize(sc, list(list(1.1, 2.2), list(1.2, 2.4)))
vals <- collectAsMap(rdd)
expect_equal(vals, list(`1.1` = 2.2, `1.2` = 2.4))

rdd <- parallelize(sc, list(list(1, "a"), list(2, "b")))
vals <- collectAsMap(rdd)
expect_equal(vals, list(`1` = "a", `2` = "b"))
})

0 comments on commit 4914091

Please sign in to comment.