tests/testthat/test_sglg.R

context("Length of the list that is returned by the sglg() function.")

test_that("test if sglg() returns a list of length 36", {
    x3 <- as.data.frame(example_sglg$x3)
    colnames(x3) <- "x3"
    expect_length(sglg(y2 ~ x2 - 1, npc = x3, data = example_sglg), 36)
})

context("Testing messages that are returned by the sglg() function.")
test_that("test if sglg() returns warning messages.", {
    expect_error(sglg(npc = x3, data = example_sglg), "The formula argument is missing.")
    expect_error(sglg(y2 ~ x2 - 1, npc = x3), "The data argument is missing.")
    expect_error(sglg(y2 ~ x2 - 1, data = example_sglg), "This kind of model need at least one non-parametric component.")
})

Try the sglg package in your browser

Any scripts or data that you put into this service are public.

sglg documentation built on Sept. 4, 2022, 9:05 a.m.