Add unittest for garbage collection's safety in R (#1490)

* Add test for garbage collection safety
This commit is contained in:
Tong He 2016-08-19 16:55:03 -07:00 committed by GitHub
parent 664a3bc7de
commit b8e6551734

View File

@ -0,0 +1,15 @@
require(xgboost)
context("Garbage Collection Safety Check")
test_that("train and prediction when gctorture is on", {
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
gctorture(TRUE)
bst <- xgboost(data = train$data, label = train$label, max.depth = 2,
eta = 1, nthread = 2, nround = 2, objective = "binary:logistic")
pred <- predict(bst, test$data)
gctorture(FALSE)
})