Skip to content

Commit

Permalink
Add more test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sun Rui committed Feb 5, 2015
1 parent d9da451 commit 91b2fd6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/inst/tests/test_rdd.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ test_that("sortBy() on RDDs", {
sortedRdd <- sortBy(rdd, function(x) { x }, ascending = FALSE)
actual <- collect(sortedRdd)
expect_equal(actual, as.list(sort(nums, decreasing = TRUE)))

rdd2 <- parallelize(sc, sort(nums, decreasing = TRUE), 2L)
sortedRdd2 <- sortBy(rdd2, function(x) { x })
actual <- collect(sortedRdd2)
expect_equal(actual, as.list(nums))
})

test_that("keys() on RDDs", {
Expand Down Expand Up @@ -386,4 +391,10 @@ test_that("sortByKey() on pairwise RDDs", {
actual <- collect(sortedRdd)
numPairs <- lapply(nums, function(x) { list (x, x) })
expect_equal(actual, sortKeyValueList(numPairs, decreasing = TRUE))

rdd2 <- parallelize(sc, sort(nums, decreasing = TRUE), 2L)
numPairsRdd2 <- map(rdd2, function(x) { list (x, x) })
sortedRdd2 <- sortByKey(numPairsRdd2)
actual <- collect(sortedRdd2)
expect_equal(actual, numPairs)
})

0 comments on commit 91b2fd6

Please sign in to comment.