https://github.com/cran/scModels
Tip revision: 52f2e41e364dbd60836bc82b8e39535e3713f98d authored by Lisa Amrhein on 13 June 2019, 15:10:03 UTC
version 1.0.0
version 1.0.0
Tip revision: 52f2e41
test-inappropriate-parameters.R
test_that("Wrong parameters in density function", {
expect_warning(expect_true(is.nan(dpb(0, -1, 3, 20))))
expect_warning(expect_true(is.nan(dpb(1, -1, 3, 20))))
expect_warning(expect_true(is.nan(dpb(1, 5, -1, 20))))
expect_warning(expect_true(is.nan(dpb(1, 5, 3, -1))))
})
test_that("Wrong parameters in distribution function", {
expect_warning(expect_true(is.nan(ppb(2, -1, 3, 20))))
expect_warning(expect_true(is.nan(ppb(2, 5, -1, 20))))
expect_warning(expect_true(is.nan(ppb(2, 5, 3, -1))))
})
test_that("Wrong parameters in quantile function", {
expect_warning(expect_true(is.nan(qpb(-0.5, 5, 3, 20))))
expect_warning(expect_true(is.nan(qpb(0.2, -1, 3, 20))))
expect_warning(expect_true(is.nan(qpb(0.2, 5, -1, 20))))
expect_warning(expect_true(is.nan(qpb(0.2, 5, 3, -1))))
})
test_that("Wrong parameters in RNG function", {
expect_error(rpb(-1, 5, 3, 20))
expect_warning(expect_true(is.na(rpb(1, -1, 3, 20))))
expect_warning(expect_true(is.na(rpb(1, 5, -1, 20))))
expect_warning(expect_true(is.na(rpb(1, 5, 3, -1))))
})
