From c6df0afd748296f5c4a5c9517c209fac0d586cb1 Mon Sep 17 00:00:00 2001 From: Ven Popov Date: Sun, 17 Mar 2024 11:39:00 +0100 Subject: [PATCH] add test showing failed run with adapt_engaged=FALSE - turns out cmdstan gives an error if adapt_engaged=FALSE and save_metric=TRUE --- tests/testthat/test-model-sample.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testthat/test-model-sample.R b/tests/testthat/test-model-sample.R index 67af824e..5857a56d 100644 --- a/tests/testthat/test-model-sample.R +++ b/tests/testthat/test-model-sample.R @@ -212,6 +212,12 @@ test_that("sample() method runs when fixed_param = TRUE", { expect_equal(fit_500_w$metadata()$algorithm, "fixed_param") }) +test_that("sample() method runs when adapt_engaged = FALSE", { + expect_sample_output(fit <- mod$sample(data = data_list, chains = 1, adapt_engaged = FALSE), 1) + draws <- try(fit$draws(), silent = TRUE) + expect_false(inherits(draws, "try-error")) +}) + test_that("chain_ids work with sample()", { mod$compile() expect_sample_output(fit12 <- mod$sample(data = data_list, chains = 2, chain_ids = c(10,12)))