From 3a49e1bdb1c83c720a1cc1a471bcc9da7085b43c Mon Sep 17 00:00:00 2001 From: terrytangyuan Date: Mon, 7 Sep 2015 21:56:50 -0400 Subject: [PATCH] TST: Added more checks for testing custom objective --- R-package/tests/testthat/test_custom_objective.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R-package/tests/testthat/test_custom_objective.R b/R-package/tests/testthat/test_custom_objective.R index a941e39c8..9fcbeca4d 100644 --- a/R-package/tests/testthat/test_custom_objective.R +++ b/R-package/tests/testthat/test_custom_objective.R @@ -28,6 +28,8 @@ test_that("custom objective works", { objective=logregobj, eval_metric=evalerror) bst <- xgb.train(param, dtrain, num_round, watchlist) + expect_equal(class(bst), "xgb.Booster") + expect_equal(length(bst$raw), 1064) attr(dtrain, 'label') <- getinfo(dtrain, 'label') logregobjattr <- function(preds, dtrain) { @@ -40,4 +42,6 @@ test_that("custom objective works", { param <- list(max.depth=2, eta=1, nthread = 2, silent=1, objective=logregobjattr, eval_metric=evalerror) bst <- xgb.train(param, dtrain, num_round, watchlist) + expect_equal(class(bst), "xgb.Booster") + expect_equal(length(bst$raw), 1064) }) \ No newline at end of file