From ec6be9ee904f2740126ba462597470fcab0f37f1 Mon Sep 17 00:00:00 2001 From: perrydv Date: Sun, 23 Jun 2024 14:06:22 -0700 Subject: [PATCH] tweak dDHMM AD test tolderance --- inst/AD_test_utils.R | 5 ++++- tests/testthat/test-AD.R | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/inst/AD_test_utils.R b/inst/AD_test_utils.R index 2390c2e..03394c6 100644 --- a/inst/AD_test_utils.R +++ b/inst/AD_test_utils.R @@ -290,15 +290,17 @@ test_AD2_oneCall <- function(Robj, Cobj, c("C", "R")[as.integer(grepl("^R", names(ansSet)))+1]) RansSet <- splitAnsSet[["R"]] CansSet <- splitAnsSet[["C"]] + if(pass) if(length(RansSet) > 1) { pass <- pass && all_equal_list(RansSet[[1]], RansSet[-1], tol = RRrelTol[[o]], abs_threshold = RRabsThresh, info = paste0("(RR order ", o,")")) if(!pass) { cat(paste('Some R-to-R derivatives do not match for order',o)) - browser() + # browser() } } + if(pass) if(length(RansSet) > 0 && length(CansSet) > 0) { pass <- pass && all_equal_list(RansSet[[1]], CansSet, tol = RCrelTol[[o]], abs_threshold = RCabsThresh, @@ -308,6 +310,7 @@ test_AD2_oneCall <- function(Robj, Cobj, browser() } } + if(pass) if(length(CansSet) > 1) { pass <- pass && all_equal_list(CansSet[[1]], CansSet[-1], CCrelTol[[o]], abs_threshold = CCabsThresh, diff --git a/tests/testthat/test-AD.R b/tests/testthat/test-AD.R index 7981bac..3089fc6 100644 --- a/tests/testthat/test-AD.R +++ b/tests/testthat/test-AD.R @@ -231,7 +231,6 @@ test_that ("dNmixture works with AD", { Cmodel <- compileNimble(Rmodel) Cmodel$calculate() - nodesList_case1 <- setup_update_and_constant_nodes_for_tests(Rmodel, c('prob', 'lambda', 'theta', 's')) v1_case1 <- list(arg1 = c(prob, lambda, theta, s)) # taping values for prob and lambda v2_case1 <- list(arg1 = c(prob2, lambda2, theta2, s2)) # testing values for prob and lambda @@ -983,7 +982,7 @@ test_that("dDHMM works with AD", { res <- model_calculate_test_case(Rmodel, Cmodel, deriv_nf = model_calculate_test, nodesList = nodesList_case1, v1 = v1_case1, v2 = v2_case1, order = 0:2, - RCrelTol = c(3e-15, 1e-8, 1e-3, 1e-14)) + RCrelTol = c(3e-15, 1e-8, 2e-3, 1e-14)) #######