context("exploitation")
# reporting rate & exploitation values ------------------------------------
test_that(desc = "reporting rate is correct", code = {
rr <- ReportingRate(rr = 5, rt = 175, nr = 10, nt = 175)
expect_equal(object = rr, expected = list(RepRate = 0.5, VarRepRate = 0.075))
})
test_that(desc = "exploitation output is correct", code = {
e <- Exploitation(rr = 5, rt = 175, repRate = 0.5, tagL = 0.05, tagM = 0.05)
expected_out<- list(
NumRet = 5,
NumRel = 175,
RepRate = 0.5,
Mu = 5 / 175,
MuPrime = (5 / 175) / (0.5 * (1 - 0.05) * (1 - 0.05))
)
expect_equal(object = e, expected = expected_out)
})
# expected errors ---------------------------------------------------------
test_that(desc = "exploitation error is correct", code = {
expect_error(
object = Exploitation(
rr = 5,
rt = "one",
repRate = 0.5,
tagL = 0.05,
tagM = 0.05
),
expected = "All arguments must be numeric."
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.