From 0bf78762907e187b9c94eedd90de3200fc18b4e3 Mon Sep 17 00:00:00 2001 From: Marvin Wright Date: Tue, 7 Nov 2023 22:50:50 +0100 Subject: [PATCH] update tests --- tests/testthat/test_classification.R | 4 ++-- tests/testthat/test_print.R | 2 +- tests/testthat/test_regression.R | 4 ++-- tests/testthat/test_survival.R | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test_classification.R b/tests/testthat/test_classification.R index 9f219cf05..0d015c9de 100644 --- a/tests/testthat/test_classification.R +++ b/tests/testthat/test_classification.R @@ -10,9 +10,9 @@ rg.class <- ranger(Species ~ ., data = iris) rg.mat <- ranger(dependent.variable.name = "Species", data = dat, classification = TRUE) ## Basic tests (for all random forests equal) -test_that("classification result is of class ranger with 14 elements", { +test_that("classification result is of class ranger with 15 elements", { expect_is(rg.class, "ranger") - expect_equal(length(rg.class), 14) + expect_equal(length(rg.class), 15) }) test_that("classification prediction returns factor", { diff --git a/tests/testthat/test_print.R b/tests/testthat/test_print.R index fd9f3512b..3ca91b4a8 100644 --- a/tests/testthat/test_print.R +++ b/tests/testthat/test_print.R @@ -16,7 +16,7 @@ expect_that(print(rf$forest), prints_text("Ranger forest object")) expect_that(print(predict(rf, iris)), prints_text("Ranger prediction")) ## Test str ranger function -expect_that(str(rf), prints_text("List of 14")) +expect_that(str(rf), prints_text("List of 15")) ## Test str forest function expect_that(str(rf$forest), prints_text("List of 9")) diff --git a/tests/testthat/test_regression.R b/tests/testthat/test_regression.R index 8bb3d11a6..dd3bdd4ea 100644 --- a/tests/testthat/test_regression.R +++ b/tests/testthat/test_regression.R @@ -7,9 +7,9 @@ context("ranger_reg") rg.reg <- ranger(Sepal.Length ~ ., data = iris) ## Basic tests (for all random forests equal) -test_that("regression result is of class ranger with 14 elements", { +test_that("regression result is of class ranger with 15 elements", { expect_is(rg.reg, "ranger") - expect_equal(length(rg.reg), 14) + expect_equal(length(rg.reg), 15) }) test_that("regression prediction returns numeric vector", { diff --git a/tests/testthat/test_survival.R b/tests/testthat/test_survival.R index 6676d6e0b..6226eb6fb 100644 --- a/tests/testthat/test_survival.R +++ b/tests/testthat/test_survival.R @@ -8,9 +8,9 @@ context("ranger_surv") rg.surv <- ranger(Surv(time, status) ~ ., data = veteran, num.trees = 10) ## Basic tests (for all random forests equal) -test_that("survival result is of class ranger with 15 elements", { +test_that("survival result is of class ranger with 17 elements", { expect_is(rg.surv, "ranger") - expect_equal(length(rg.surv), 15) + expect_equal(length(rg.surv), 17) }) test_that("results have right number of trees", {