From 35c9838724d3b5aa6c3ebf042f38af1a241faefb Mon Sep 17 00:00:00 2001 From: Bai-Li-NOAA Date: Wed, 25 Sep 2024 12:18:33 -0400 Subject: [PATCH] test: fix typo in snapshot test --- tests/testthat/_snaps/fimsfit.md | 2 +- .../testthat/helper-integration-tests-setup.R | 30 ++++++++++--------- tests/testthat/test-fimsfit.R | 4 +-- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/testthat/_snaps/fimsfit.md b/tests/testthat/_snaps/fimsfit.md index be8eb14a..f104f43d 100644 --- a/tests/testthat/_snaps/fimsfit.md +++ b/tests/testthat/_snaps/fimsfit.md @@ -9,6 +9,6 @@ i Maximum gradient= 1e-04 i Negative log likelihood (NLL): * Marginal NLL= 1498.433 - * Total NLL= 1498.33 + * Total NLL= 1498.433 i Terminal SB= 10000 diff --git a/tests/testthat/helper-integration-tests-setup.R b/tests/testthat/helper-integration-tests-setup.R index 04c903e1..dc1d4295 100644 --- a/tests/testthat/helper-integration-tests-setup.R +++ b/tests/testthat/helper-integration-tests-setup.R @@ -43,11 +43,11 @@ #' estimation_mode = TRUE #' ) setup_and_run_FIMS_without_wrappers <- function(iter_id, - om_input_list, - om_output_list, - em_input_list, - estimation_mode = TRUE, - map = list()) { + om_input_list, + om_output_list, + em_input_list, + estimation_mode = TRUE, + map = list()) { # Load operating model data for the current iteration om_input <- om_input_list[[iter_id]] om_output <- om_output_list[[iter_id]] @@ -208,7 +208,7 @@ setup_and_run_FIMS_without_wrappers <- function(iter_id, opt <- NULL if (estimation_mode == TRUE) { opt <- stats::nlminb(obj$par, obj$fn, obj$gr, - control = list(eval.max = 800, iter.max = 800) + control = list(eval.max = 800, iter.max = 800) ) } # Call report using MLE parameter values, or @@ -277,11 +277,11 @@ setup_and_run_FIMS_without_wrappers <- function(iter_id, #' estimation_mode = TRUE #' ) setup_and_run_FIMS_with_wrappers <- function(iter_id, - om_input_list, - om_output_list, - em_input_list, - estimation_mode = TRUE, - map = list()) { + om_input_list, + om_output_list, + em_input_list, + estimation_mode = TRUE, + map = list()) { # Load operating model data for the current iteration om_input <- om_input_list[[iter_id]] om_output <- om_output_list[[iter_id]] @@ -435,7 +435,7 @@ setup_and_run_FIMS_with_wrappers <- function(iter_id, parameters <- list(p = get_fixed()) input <- list() input$parameters <- parameters - input$version = "Model Comparison Project example" + input$version <- "Model Comparison Project example" fit <- fit_fims(input, do.fit = estimation_mode) clear() @@ -445,7 +445,9 @@ setup_and_run_FIMS_with_wrappers <- function(iter_id, obj = fit$obj, opt = fit$opt, report = fit$rep, - sdr_report = fit$sd + sdr_report = fit$sd, + fit = fit )) -} + +} diff --git a/tests/testthat/test-fimsfit.R b/tests/testthat/test-fimsfit.R index 9c6ec989..97dbd890 100644 --- a/tests/testthat/test-fimsfit.R +++ b/tests/testthat/test-fimsfit.R @@ -47,9 +47,9 @@ test_that("print.fimsfit prints summary correctly", { max_gradient = 0.0001, objective = 1498.433), rep = list(ssb = list(rep(10000, 5)), - jnll = 1498.33), + jnll = 1498.433), parList = list() - ) + ) class(fit_obj) <- c("fimsfit", "list") expect_snapshot(