Skip to content

Commit

Permalink
Test cases for PUB-863, PUB-864.
Browse files Browse the repository at this point in the history
  • Loading branch information
rpeck committed Jul 22, 2014
1 parent 70f2c5d commit 17d92c7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f")))
source('../findNSourceUtils.R')

test.pub_863_disallow_addFunction_of_functions_that_already_exist <- function(localH2O) {

covtype.hex <- h2o.importFile(localH2O, normalizePath(locate("smalldata/covtype/covtype.20k.data")), "cov")

covtype.local = as.data.frame(covtype.hex)

# Are we in the right universe?
expect_equal(20000, dim(covtype.local)[1])
expect_equal(55, dim(covtype.local)[2])

###########################################################
# execs
###########################################################

fun = function(x) { mean( x[,2]) }
expect_error(h2o.addFunction(object = localH2O, fun = fun, name = "mean" ))

testEnd()

}

doTest("PUB-863 disallow addFunction of functions that already exist.", test.pub_863_disallow_addFunction_of_functions_that_already_exist)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f")))
source('../findNSourceUtils.R')

test.pub_864_allow_addFunction_functions_to_be_executed_more_than_once <- function(localH2O) {

covtype.hex <- h2o.importFile(localH2O, normalizePath(locate("smalldata/covtype/covtype.20k.data")), "cov")

covtype.local = as.data.frame(covtype.hex)

# Are we in the right universe?
expect_equal(20000, dim(covtype.local)[1])
expect_equal(55, dim(covtype.local)[2])

###########################################################
# execs
###########################################################

fun = function(x) { mean( x[,2]) }
h2o.addFunction(object = localH2O, fun = fun, name = "m" )
h2o.exec(ddply(covtype.hex, c(2), m))
h2o.exec(ddply(covtype.hex, c(2), m))

testEnd()

}

doTest("PUB-864 allow addFunction functions to be executed more than once.", test.pub_864_allow_addFunction_functions_to_be_executed_more_than_once)

0 comments on commit 17d92c7

Please sign in to comment.