From db93b780651a7a63777f3d1a0f714577a613c10d Mon Sep 17 00:00:00 2001 From: "Zhian N. Kamvar" Date: Thu, 16 May 2024 11:15:32 -0700 Subject: [PATCH] fix tolerance tests --- tests/testthat/test-round-robin.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-round-robin.R b/tests/testthat/test-round-robin.R index 92b1ed1e..142f4a56 100644 --- a/tests/testthat/test-round-robin.R +++ b/tests/testthat/test-round-robin.R @@ -72,10 +72,12 @@ test_that("correction is properly applied in rraf", { # sum_to_one argument augments does what it says monc_sum2one <- vapply(monc_sto, sum, numeric(1)) - tol <- min(monc_vec - monc_sum2one) + # If the sum to one works, then we should have leftover tolerance that is + # greater than zero but less than one. + tol <- sum(monc_vec - monc_sum2one) expect_lt(tol, 1) + expect_gt(tol, 0) expect_equal(sum(monc_sum2one), nLoc(monpop)) - expect_equal(monc_vec, monc_sum2one, tolerance = tol) # The default is 1/n expect_equivalent(SER(monc), 1/nInd(monpop)) expect_true(identical(SER(monc)[[1]], SED(monc)[[1]]))