Add unittest for garbage collection's safety in R (#1490)
* Add test for garbage collection safety
This commit is contained in:
parent
664a3bc7de
commit
b8e6551734
15
R-package/tests/testthat/test_gc_safety.R
Normal file
15
R-package/tests/testthat/test_gc_safety.R
Normal 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)
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user