Nothing
dim_basis <- getFromNamespace("dim_basis", "np")
dimBS <- getFromNamespace("dimBS", "np")
test_that("GLP validators handle non-numeric and missing inputs deterministically", {
expect_null(np:::npValidateGlpDegree("lc", "a", 1L))
expect_identical(np:::npValidateGlpDegree("lp", NULL, 0L), integer(0))
expect_error(
np:::npValidateGlpDegree("lp", "a", 1L),
"finite non-negative integers"
)
expect_error(
np:::npValidateGlpDegree("lp", c(1, NA_real_), 2L),
"finite non-negative integers"
)
expect_warning(
expect_identical(np:::npValidateGlpDegree("lp", 30L, 1L), 30L),
"unusually large polynomial degree values above 25"
)
expect_error(
np:::npValidateGlpDegree("lp", 101L, 1L),
"\\[0,100\\]"
)
expect_null(np:::npValidateGlpGradientOrder("lc", "a", 1L))
expect_identical(np:::npValidateGlpGradientOrder("lp", NULL, 0L), integer(0))
expect_error(
np:::npValidateGlpGradientOrder("lp", "a", 1L),
"finite positive integers"
)
expect_error(
np:::npValidateGlpGradientOrder("lp", c(1, NA_real_), 2L),
"finite positive integers"
)
})
test_that("dim_basis validates integer-like vectors before coercion", {
expect_error(dim_basis(degree = "a"), "degree must contain finite non-negative integers")
expect_error(dim_basis(degree = 1L, segments = "a"), "segments must contain finite positive integers")
expect_error(
dim_basis(degree = integer(0), include = c("a"), categories = c(0L)),
"include must contain finite non-negative integers"
)
expect_error(
dim_basis(degree = integer(0), include = c(0L), categories = c("a")),
"categories must contain finite non-negative integers"
)
})
test_that("dimBS compatibility wrapper matches dim_basis", {
expect_identical(
dimBS(basis = "tensor", degree = c(2L, 3L), segments = c(1L, 2L)),
dim_basis(basis = "tensor", degree = c(2L, 3L), segments = c(1L, 2L))
)
expect_identical(
dimBS(basis = "glp",
kernel = FALSE,
degree = c(2L, 1L),
segments = c(1L, 1L),
include = c(1L, 0L, 1L),
categories = c(3L, 2L, 4L)),
dim_basis(basis = "glp",
kernel = FALSE,
degree = c(2L, 1L),
segments = c(1L, 1L),
include = c(1L, 0L, 1L),
categories = c(3L, 2L, 4L))
)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.