Skip to content

Commit

Permalink
add basic test for host-only run of defoliate_trees()
Browse files Browse the repository at this point in the history
  • Loading branch information
chguiterman committed Nov 9, 2020
1 parent 2d88360 commit 2e5c406
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/test-defoliate.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ 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)
})

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"))
})

0 comments on commit 2e5c406

Please sign in to comment.