Skip to content

Commit

Permalink
add test for n = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinsimpson committed Mar 6, 2024
1 parent 643de45 commit e300a61
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test-samplers.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ test_that("generate_draws() works for a GAM", {
expect_identical(drws1, drws2)
})

test_that("generate_draws() works for a GAM, 1 draw only", {
expect_silent(drws1 <- generate_draws(m_gam, n = 1, method = "gaussian",
seed = 2))
expect_silent(drws2 <- generate_draws(m_gam, n = 1, method = "gaussian",
seed = 2))
expect_type(drws1, "double")
expect_true(is.matrix(drws1))
expect_identical(dim(drws1), c(1L, 37L))
expect_identical(drws1, drws2)
})

test_that("generate_draws() works for a GAM with MH", {
expect_silent(drws1 <- generate_draws(m_gam, n = 20, method = "mh",
burnin = 100, thin = 2, t_df = 4, rw_scale = 0.3, seed = 2))
Expand Down

0 comments on commit e300a61

Please sign in to comment.