Skip to content

Commit

Permalink
add tests for new diagonalize argument
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Jul 17, 2024
1 parent 23eb93f commit 9aae5a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/testthat/test-basis.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ test_that("basis() works with a simple smooth", {
expect_named(bs, c(bs_nms, "x0"))
})

test_that("basis() works constraints and diagonalize", {
expect_silent(bs <- basis(s(x0), data = su_eg4, constraints = TRUE,
diagonalize = TRUE))
expect_s3_class(bs, "basis")
expect_named(bs, c(bs_nms, "x0"))
})

test_that("basis() works with a factor by smooth", {
expect_silent(bs <- basis(s(x2, by = fac), data = su_eg4))
expect_s3_class(bs, "basis")
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-penalty.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ test_that("penalty() works with a simple GAM", {
expect_named(p, pen_nms)
})

test_that("penalty() works with constraints and diagonalize", {
expect_silent(p <- penalty(s(x, bs = "bs"), data = data_sim("gwf2", seed = 2),
constraints = TRUE, diagonalize = TRUE))
expect_s3_class(p, "penalty_df")
expect_named(p, pen_nms)
})

test_that("penalty() resclaing works with a simple GAM", {
expect_silent(p <- penalty(su_m_su_eg4, rescale = TRUE))
expect_s3_class(p, "penalty_df")
Expand Down

0 comments on commit 9aae5a7

Please sign in to comment.