Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Jan 16, 2024
1 parent 8bafeeb commit d79a666
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
14 changes: 3 additions & 11 deletions tests/testthat/test-checks.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
test_that("Checks work", {
expect_error(
check_offspring_valid(1),
"character string"
)
expect_error(
check_offspring_func_valid("rrpois"),
"does not exist"
"not found"
)
expect_error(
check_generation_time_valid("a"),
"must be a function"
"Must be a function"
)
expect_error(
check_generation_time_valid(function(x) rep("a", 10)),
"numeric"
)
expect_error(
check_generation_time_valid(function(x) 3),
"vector of length"
)
expect_error(
check_ntrees_valid(1.1),
"less than"
"Must have length"
)
})
2 changes: 1 addition & 1 deletion tests/testthat/test-likelihood.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test_that("Errors are thrown", {
statistic = "size",
lambda = 0.5
),
"must be specified as a character string"
"Must be of type"
)
expect_error(
likelihood(
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test_that("simulate_tree throws errors", {
statistic = "length",
lambda = 0.9
),
"does not exist"
"not found"
)
expect_error(
simulate_tree(
Expand Down Expand Up @@ -117,7 +117,7 @@ test_that("simulate_tree throws errors", {
lambda = 0.9,
generation_time = c(1, 2)
),
"must be a function"
"Must be a function"
)
expect_error(
simulate_tree(
Expand All @@ -126,7 +126,7 @@ test_that("simulate_tree throws errors", {
statistic = "length",
lambda = 0.9
),
"character string"
"Must be of type"
)
expect_error(
simulate_tree(
Expand All @@ -148,7 +148,7 @@ test_that("simulate_summary throws errors", {
statistic = "length",
lambda = 0.9
),
"does not exist"
"not found"
)
expect_error(
simulate_summary(
Expand Down Expand Up @@ -177,7 +177,7 @@ test_that("simulate_summary throws errors", {
statistic = "length",
lambda = 0.9
),
"character string"
"Must be of type"
)
})

Expand Down

0 comments on commit d79a666

Please sign in to comment.