From e82845343ea337df2add818055e58c951eec96a8 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 22 May 2024 13:33:17 +0300 Subject: [PATCH] Add test --- DESCRIPTION | 2 +- tests/testthat/test-model-expose-functions.R | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ca2fd596..726186ec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cmdstanr Title: R Interface to 'CmdStan' -Version: 0.8.0 +Version: 0.8.0.9000 Date: 2024-05-18 Authors@R: c(person(given = "Jonah", family = "Gabry", role = "aut", diff --git a/tests/testthat/test-model-expose-functions.R b/tests/testthat/test-model-expose-functions.R index 516d39c1..b3bb39c5 100644 --- a/tests/testthat/test-model-expose-functions.R +++ b/tests/testthat/test-model-expose-functions.R @@ -419,3 +419,17 @@ test_that("Exposing functions with precompiled model gives meaningful error", { fixed = TRUE ) }) + +test_that("Functions with SUNDIALS/KINSOL methods link correctly", { + modcode <- " + functions { + vector dummy_functor(vector guess, vector theta, data array[] real tails, data array[] int x_i) { + return [1, 1]'; + } + vector call_solver(vector guess, vector theta, data array[] real tails, data array[] int x_i) { + return algebra_solver_newton(dummy_functor, guess, theta, tails, x_i); + } + }" + mod <- cmdstan_model(write_stan_file(modcode), force_recompile=TRUE) + expect_no_error(mod$expose_functions()) +})