Skip to content

Commit

Permalink
Test for errors when switch statement does not match
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Feb 6, 2024
1 parent ed3b5bd commit 784bbe4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/testthat/test-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ test_that("update_chain_stat works correctly", {
),
stat_latest + pmin(1, n_offspring)
)
expect_error(
.update_chain_stat(
stat_type = "foo",
stat_latest = stat_latest,
n_offspring = n_offspring
),
"stat_type must be 'size' or 'length'"
)
})

test_that("get_statistic_func works correctly", {
Expand All @@ -38,4 +46,8 @@ test_that("get_statistic_func works correctly", {
.get_statistic_func(chain_statistic = "length"),
rgen_length
)
expect_error(
.get_statistic_func(chain_statistic = "foo"),
"chain_statistic must be 'size' or 'length'"
)
})

0 comments on commit 784bbe4

Please sign in to comment.