From 2e5c406c2a168881f1cad07e5d4be22145dcf455 Mon Sep 17 00:00:00 2001 From: Chris Guiterman Date: Mon, 9 Nov 2020 10:24:12 -0500 Subject: [PATCH] add basic test for host-only run of `defoliate_trees()` #2 #5 --- tests/testthat/test-defoliate.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/testthat/test-defoliate.R b/tests/testthat/test-defoliate.R index cc80bc0..7f11557 100644 --- a/tests/testthat/test-defoliate.R +++ b/tests/testthat/test-defoliate.R @@ -7,6 +7,7 @@ test_defol <- defoliate_trees(host_tree = dfoliatR::efk_h, nonhost_chron = dfoliatR::efk_nh, series_end_event = TRUE) + test_that("gsi calculates the growth stress index consistently", { expect_equal(test_defol$gsi, efk_defol$gsi) }) @@ -14,3 +15,10 @@ test_that("gsi calculates the growth stress index consistently", { test_that("id_defoliation runs consistently", { expect_equal(test_defol$defol_status, efk_defol$defol_status) }) + +test_that("defoliate_trees() runs in host-only mode", { + host_only_defol <- defoliate_trees(host_tree = dfoliatR::dmj_h) + expect_equal(as.vector(host_only_defol[1:11, "defol_status"]), + c("nd", "nd", "nd", "nd", "nd", "nd", "nd", "defol", + "max_defol", "defol", "defol")) +})