From a3fd8017510b4cccea62f745242219f070af7912 Mon Sep 17 00:00:00 2001 From: Daniel Sabanes Bove Date: Tue, 26 May 2026 14:21:51 +0800 Subject: [PATCH 1/4] few fixes --- tests/testthat/helper-setup.R | 8 ++++++++ tests/testthat/test-LongitudinalGSF.R | 3 ++- tests/testthat/test-simulate.R | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/testthat/helper-setup.R b/tests/testthat/helper-setup.R index 5ef0c091b..fdfa36717 100644 --- a/tests/testthat/helper-setup.R +++ b/tests/testthat/helper-setup.R @@ -9,6 +9,14 @@ is_full_test <- function() { toupper(Sys.getenv("JMPOST_FULL_TEST")) == "TRUE" } +set_full_test <- function() { + Sys.setenv(JMPOST_FULL_TEST = "TRUE") +} + +disable_full_test <- function() { + Sys.setenv(JMPOST_FULL_TEST = "FALSE") +} + is_graph_snapshot_enabled <- function() { toupper(Sys.getenv("JMPOST_GRAPH_SNAPSHOT")) == "TRUE" } diff --git a/tests/testthat/test-LongitudinalGSF.R b/tests/testthat/test-LongitudinalGSF.R index 966c12e4e..8b0ecca33 100644 --- a/tests/testthat/test-LongitudinalGSF.R +++ b/tests/testthat/test-LongitudinalGSF.R @@ -487,7 +487,8 @@ test_that("Can recover known distributional parameters from unscaled variance GS iter_sampling = 800, chains = 2, refresh = 200, - parallel_chains = 2 + parallel_chains = 2, + seed = 123 ) }) }) diff --git a/tests/testthat/test-simulate.R b/tests/testthat/test-simulate.R index a291ee00f..4b901daa9 100644 --- a/tests/testthat/test-simulate.R +++ b/tests/testthat/test-simulate.R @@ -160,9 +160,9 @@ test_that("simulate works with lambda_censor", { ) joined <- dplyr::left_join( - results@survival[, c("subject", "time", "event")], - results@longitudinal[, c("subject", "time", "observed")], - by = "subject" + results@survival[, c("id", "time", "event")], + results@longitudinal[, c("id", "time", "observed")], + by = "id" ) expect_true(all(!joined$observed[joined$time.y > joined$time.x])) From da57253ae5e84f9ba0537c3487fb98c9a3fc7e4e Mon Sep 17 00:00:00 2001 From: Daniel Sabanes Bove Date: Tue, 26 May 2026 14:27:44 +0800 Subject: [PATCH 2/4] rename activation function --- tests/testthat/helper-setup.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/helper-setup.R b/tests/testthat/helper-setup.R index fdfa36717..65b4cb234 100644 --- a/tests/testthat/helper-setup.R +++ b/tests/testthat/helper-setup.R @@ -9,7 +9,7 @@ is_full_test <- function() { toupper(Sys.getenv("JMPOST_FULL_TEST")) == "TRUE" } -set_full_test <- function() { +activate_full_test <- function() { Sys.setenv(JMPOST_FULL_TEST = "TRUE") } From 5dc62d2b5d62a6e81618fe4fae316d6aa523d5f7 Mon Sep 17 00:00:00 2001 From: Daniel Sabanes Bove Date: Tue, 26 May 2026 14:28:45 +0800 Subject: [PATCH 3/4] fix check note --- R/simulate.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/simulate.R b/R/simulate.R index b7353364a..18972459b 100644 --- a/R/simulate.R +++ b/R/simulate.R @@ -453,7 +453,7 @@ SimJointDataResults <- function( return( .SimJointData( - survival = os_dat |> dplyr::rename(all_of(original_names)), + survival = os_dat |> dplyr::rename(dplyr::all_of(original_names)), longitudinal = lm_dat2[, c( "subject", "arm", @@ -462,7 +462,7 @@ SimJointDataResults <- function( "sld", "observed" )] |> - dplyr::rename(all_of(original_names)) + dplyr::rename(dplyr::all_of(original_names)) ) ) } From 97ba93e070eb503ebfd5ab66b8029138068cac65 Mon Sep 17 00:00:00 2001 From: Daniel Sabanes Bove Date: Tue, 26 May 2026 16:30:57 +0800 Subject: [PATCH 4/4] fix more tests --- tests/testthat/test-SurvivalExponential.R | 8 ++++++-- tests/testthat/test-SurvivalGamma.R | 8 ++++++-- tests/testthat/test-SurvivalLoglogistic.R | 8 ++++++-- tests/testthat/test-SurvivalWeibullPH.R | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test-SurvivalExponential.R b/tests/testthat/test-SurvivalExponential.R index e4d8f7202..a81499481 100644 --- a/tests/testthat/test-SurvivalExponential.R +++ b/tests/testthat/test-SurvivalExponential.R @@ -31,7 +31,10 @@ test_that("SurvivalExponential can recover true parameter (including covariates) beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]), beta_cont = true_beta[3], ), - longitudinal = SimLongitudinalRandomSlope(slope_mu = 0) + longitudinal = SimLongitudinalRandomSlope( + slope_mu = 0, + slope_sigma = 0.5 + ) ) dat_os <- jdat@survival @@ -59,7 +62,8 @@ test_that("SurvivalExponential can recover true parameter (including covariates) iter_warmup = 500, chains = 1, refresh = 0, - parallel_chains = 1 + parallel_chains = 1, + seed = 123 ) }) diff --git a/tests/testthat/test-SurvivalGamma.R b/tests/testthat/test-SurvivalGamma.R index 9a7ae2b1f..64b3254dc 100644 --- a/tests/testthat/test-SurvivalGamma.R +++ b/tests/testthat/test-SurvivalGamma.R @@ -59,7 +59,10 @@ test_that("SurvivalGamma can recover known values", { beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]), beta_cont = true_beta[3], ), - longitudinal = SimLongitudinalRandomSlope(slope_mu = 0), + longitudinal = SimLongitudinalRandomSlope( + slope_mu = 0, + slope_sigma = 0.5 + ), .silent = TRUE ) @@ -94,7 +97,8 @@ test_that("SurvivalGamma can recover known values", { iter_sampling = 400, chains = 2, refresh = 100, - parallel_chains = 2 + parallel_chains = 2, + seed = 123 ) }) }) diff --git a/tests/testthat/test-SurvivalLoglogistic.R b/tests/testthat/test-SurvivalLoglogistic.R index ae995102f..e079a1e29 100644 --- a/tests/testthat/test-SurvivalLoglogistic.R +++ b/tests/testthat/test-SurvivalLoglogistic.R @@ -43,7 +43,10 @@ test_that("SurvivalLogLogistic can recover known values", { beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]), beta_cont = true_beta[3], ), - longitudinal = SimLongitudinalRandomSlope(slope_mu = 0), + longitudinal = SimLongitudinalRandomSlope( + slope_mu = 0, + slope_sigma = 0.5 + ), .silent = TRUE ) @@ -77,7 +80,8 @@ test_that("SurvivalLogLogistic can recover known values", { iter_sampling = 450, chains = 1, refresh = 0, - parallel_chains = 1 + parallel_chains = 1, + seed = 123 ) }) diff --git a/tests/testthat/test-SurvivalWeibullPH.R b/tests/testthat/test-SurvivalWeibullPH.R index 4985f9e92..bbe6c9d77 100644 --- a/tests/testthat/test-SurvivalWeibullPH.R +++ b/tests/testthat/test-SurvivalWeibullPH.R @@ -50,7 +50,10 @@ test_that("SurvivalWeibullPH can recover known values", { beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]), beta_cont = true_beta[3], ), - longitudinal = SimLongitudinalRandomSlope(slope_mu = 0), + longitudinal = SimLongitudinalRandomSlope( + slope_mu = 0, + slope_sigma = 0.5 + ), .silent = TRUE ) @@ -84,7 +87,8 @@ test_that("SurvivalWeibullPH can recover known values", { iter_sampling = 400, chains = 1, refresh = 0, - parallel_chains = 1 + parallel_chains = 1, + seed = 123 ) })