From f4a2865d925f06bed1ca2d69ca7bb24aaa753b00 Mon Sep 17 00:00:00 2001 From: Koen Derks Date: Wed, 4 Oct 2023 15:14:12 +0200 Subject: [PATCH] Skip many tests on CRAN --- tests/testthat/test-MUS.R | 2 ++ tests/testthat/test-aicpa-appendix-a.R | 5 ++++- tests/testthat/test-aicpa-appendix-c.R | 1 + tests/testthat/test-audit-sampler.R | 2 ++ tests/testthat/test-evaluation.R | 10 ++++++++++ tests/testthat/test-ezquant.R | 1 + tests/testthat/test-other.R | 1 + tests/testthat/test-samplingbook.R | 3 +++ tests/testthat/test-smash21.R | 3 +++ tests/testthat/test-sra.R | 1 + tests/testthat/test-touwhoogduin.R | 1 + tests/testthat/test-workflow.R | 3 +++ 12 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-MUS.R b/tests/testthat/test-MUS.R index aed892a05..dbd635d1b 100644 --- a/tests/testthat/test-MUS.R +++ b/tests/testthat/test-MUS.R @@ -18,6 +18,7 @@ context("Benchmark against R package MUS") # MUS R package (version 0.1.6) test_that(desc = "(id: f12-v0.5.4-t1) Test Sample sizes for poisson distribution", { + testthat::skip_on_cran() set.seed(1) data <- data.frame(book.value = round(stats::runif(n = 500, min = 1, max = 1000))) m <- seq(10000, 20000, 1000) @@ -42,6 +43,7 @@ test_that(desc = "(id: f12-v0.5.4-t1) Test Sample sizes for poisson distribution # MUS R package (version 0.1.6) test_that(desc = "(id: f12-v0.5.4-t2) Test most likely error and upper bound using stringer bound", { + testthat::skip_on_cran() set.seed(1) data <- data.frame(book.value = round(stats::runif(n = 1000, min = 1, max = 1000))) m <- seq(10000, 20000, 500) diff --git a/tests/testthat/test-aicpa-appendix-a.R b/tests/testthat/test-aicpa-appendix-a.R index 269216406..062d40604 100644 --- a/tests/testthat/test-aicpa-appendix-a.R +++ b/tests/testthat/test-aicpa-appendix-a.R @@ -19,6 +19,7 @@ context("Benchmark against Appendix A (AICPA 2017)") # Retrieved on 28-04-2021 from https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119448617.app1 test_that(desc = "(id: f9-v0.4.0-t1) Test sample sizes for 5 percent risk of overreliance (AICPA 2017 - Appendix A: Table A-1)", { + testthat::skip_on_cran() expectedDeviationRate <- c(seq(0, 4, 0.25), 5:10, 12.50, 15.00, 17.50) / 100 tolerableDeivationRate <- c(2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20) / 100 sampleSizeMatrix <- matrix(NA, nrow = length(expectedDeviationRate), ncol = length(tolerableDeivationRate)) @@ -87,6 +88,7 @@ test_that(desc = "(id: f9-v0.4.0-t1) Test sample sizes for 5 percent risk of ove }) test_that(desc = "(id: f9-v0.4.0-t2) Test sample sizes for 10 percent risk of overreliance (AICPA 2017 - Appendix A: Table A-2)", { + testthat::skip_on_cran() expectedDeviationRate <- c(seq(0, 4, 0.25), 5:10, 12.50, 15.00, 17.50) / 100 tolerableDeivationRate <- c(2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20) / 100 sampleSizeMatrix <- matrix(NA, nrow = length(expectedDeviationRate), ncol = length(tolerableDeivationRate)) @@ -158,6 +160,7 @@ test_that(desc = "(id: f9-v0.4.0-t2) Test sample sizes for 10 percent risk of ov }) test_that(desc = "(id: f9-v0.4.0-t3) Test upper bounds for 5 percent risk of overreliance (AICPA 2017 - Appendix A: Table A-3)", { + testthat::skip_on_cran() sampleSize <- c(seq(20, 80, 5), 90, 100, 125, 150, 200, 300, 400, 500) numberOfDeviations <- 0:10 evaluationMatrix <- matrix(NA, nrow = length(sampleSize), ncol = length(numberOfDeviations)) @@ -204,6 +207,7 @@ test_that(desc = "(id: f9-v0.4.0-t3) Test upper bounds for 5 percent risk of ove }) test_that(desc = "(id: f9-v0.4.0-t4) Test upper bounds for 10 percent risk of overreliance (AICPA 2017 - Appendix A: Table A-4)", { + testthat::skip_on_cran() sampleSize <- c(seq(20, 80, 5), 90, 100, 125, 150, 200, 300, 400, 500) numberOfDeviations <- 0:10 evaluationMatrix <- matrix(NA, nrow = length(sampleSize), ncol = length(numberOfDeviations)) @@ -216,7 +220,6 @@ test_that(desc = "(id: f9-v0.4.0-t4) Test upper bounds for 10 percent risk of ov } } - aicpaMatrix <- matrix( data = c( 10.9, 18.1, 24.5, 30.5, 36.1, 41.5, 46.8, 51.9, 56.8, 61.6, 66.2, diff --git a/tests/testthat/test-aicpa-appendix-c.R b/tests/testthat/test-aicpa-appendix-c.R index 1465c38ef..bd1a74cd7 100644 --- a/tests/testthat/test-aicpa-appendix-c.R +++ b/tests/testthat/test-aicpa-appendix-c.R @@ -19,6 +19,7 @@ context("Benchmark against Appendix C (AICPA 2017)") # Retrieved on 28-04-2021 from https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119448617.app3 test_that(desc = "(id f10-v0.4.0-t1) Test Monetary Unit Sample Sizes for 5 percent risk of overreliance (AICPA 2017 - Appendix C: Table C-1)", { + testthat::skip_on_cran() riskOfIncorrectAcceptance <- c(rep(5, 6), rep(10, 5), rep(15, 5), rep(20, 5), rep(25, 5), rep(30, 4), rep(35, 4), rep(50, 4)) / 100 ratioExpectedTolerable <- c(seq(0, 0.5, 0.1), 0, seq(0.2, 0.5, 0.1), 0, seq(0.2, 0.5, 0.1), 0, seq(0.2, 0.5, 0.1), 0, seq(0.2, 0.5, 0.1), 0, seq(0.2, 0.6, 0.2), 0, seq(0.2, 0.6, 0.2), 0, seq(0.2, 0.6, 0.2)) tolerableMisstatement <- c(0.5, 0.3, 0.1, 0.08, 0.06, 0.05, 0.04, 0.03, 0.02, 0.01, 0.005) diff --git a/tests/testthat/test-audit-sampler.R b/tests/testthat/test-audit-sampler.R index 79c56be0d..70e4d73b8 100644 --- a/tests/testthat/test-audit-sampler.R +++ b/tests/testthat/test-audit-sampler.R @@ -19,6 +19,7 @@ context("Benchmark against AuditSampler software") # Retrieved on 28-04-2021 from https://cplusglobal.wordpress.com/2014/04/15/attributes-sampling/ test_that(desc = "(id: f11-v0.4.0-t1) Test Sample sizes for binomial distribution", { + testthat::skip_on_cran() expectedDeviationRate <- c(seq(0, 4, 0.25), 4.5, 5) / 100 tolerableDeivationRate <- c(2, 3, 4, 5, 6, 7, 8, 9, 10) / 100 sampleSizeMatrix <- matrix(NA, nrow = length(expectedDeviationRate), ncol = length(tolerableDeivationRate)) @@ -73,6 +74,7 @@ test_that(desc = "(id: f11-v0.4.0-t1) Test Sample sizes for binomial distributio # Retrieved on 28-04-2021 from https://cplusglobal.wordpress.com/2015/11/13/attributes-sample-size-using-the-hypergeometric-distribution/ test_that(desc = "(id: f11-v0.4.0-t1) Test Sample sizes for Hypergeometric distribution", { + testthat::skip_on_cran() populationSize <- c(rep(500, 12), rep(5000, 3), 15000, 36000) expectedErrorRate <- c(rep(1, 3), 2, rep(1, 3), 2, 3, 4, 5, 6, rep(1, 5)) / 100 tolerableErrorRate <- c(8, 6, 4, 5, 8, 6, 4, 5, 6, 7, 8, 9, 8, 6, 4, 6, 4) / 100 diff --git a/tests/testthat/test-evaluation.R b/tests/testthat/test-evaluation.R index 1f1903710..c00d4ac7f 100644 --- a/tests/testthat/test-evaluation.R +++ b/tests/testthat/test-evaluation.R @@ -389,6 +389,7 @@ test_that(desc = "(id: f3-v0.6.0-t3) Test Bayes factors for beta-binomial prior" # jfa 0.6.5 test_that(desc = "(id: f3-v0.6.5-t1) Test frequentist poisson stratification with summary statistics (Derks et al., 2022, Table 1)", { + testthat::skip_on_cran() k <- c(2, 1, 0) n <- c(6, 7, 7) N <- c(8, 11, 11) @@ -409,6 +410,7 @@ test_that(desc = "(id: f3-v0.6.5-t1) Test frequentist poisson stratification wit }) test_that(desc = "(id: f3-v0.6.5-t2) Test Bayesian poisson stratification with summary statistics (Derks et al., 2022, Table 1)", { + testthat::skip_on_cran() options("mc.iterations" = 200, "mc.warmup" = 100, "mc.chains" = 1) k <- c(2, 1, 0) n <- c(6, 7, 7) @@ -434,6 +436,7 @@ test_that(desc = "(id: f3-v0.6.5-t2) Test Bayesian poisson stratification with s }) test_that(desc = "(id: f3-v0.6.5-t3) Test frequentist binomial stratification with summary statistics (Derks et al., 2022, Table 1)", { + testthat::skip_on_cran() k <- c(2, 1, 0) n <- c(6, 7, 7) N <- c(8, 11, 11) @@ -454,6 +457,7 @@ test_that(desc = "(id: f3-v0.6.5-t3) Test frequentist binomial stratification wi }) test_that(desc = "(id: f3-v0.6.5-t4) Test Bayesian binomial stratification with summary statistics (Derks et al., 2022, Table 1)", { + testthat::skip_on_cran() options("mc.iterations" = 200, "mc.warmup" = 100, "mc.chains" = 1) k <- c(2, 1, 0) n <- c(6, 7, 7) @@ -478,6 +482,7 @@ test_that(desc = "(id: f3-v0.6.5-t4) Test Bayesian binomial stratification with }) test_that(desc = "(id: f3-v0.6.5-t5) Test stratification with data (Derks et al., 2022, Table 4)", { + testthat::skip_on_cran() options("mc.iterations" = 200, "mc.warmup" = 100, "mc.chains" = 1) data("BuildIt") BuildIt$stratum <- factor(c("high", "medium", rep(c("low", "medium", "high"), times = 1166))) @@ -522,6 +527,7 @@ test_that(desc = "(id: f3-v0.6.5-t5) Test stratification with data (Derks et al. }) test_that(desc = "(id: f3-v0.6.5-t6) Validate poststratification with stan examples", { + testthat::skip_on_cran() # https://mc-stan.org/docs/2_23/stan-users-guide/some-examples.html # 28.1.2 Polling set.seed(1) @@ -553,6 +559,7 @@ test_that(desc = "(id: f3-v0.6.5-t7) Test evaluation with non-conjugate priors", }) test_that(desc = "(id: f3-v0.6.5-t8) Test hypergeometric and beta-binomial", { + testthat::skip_on_cran() N <- 10 n <- 2 x <- 1 @@ -574,6 +581,7 @@ test_that(desc = "(id: f3-v0.6.5-t8) Test hypergeometric and beta-binomial", { }) test_that(desc = "(id: f3-v0.6.5-t9) Test Bayesian evaluation with different uniform priors, 5% materiality", { + testthat::skip_on_cran() set.seed(1) prior1 <- auditPrior(method = "default", likelihood = "binomial") prior2 <- auditPrior(method = "param", likelihood = "uniform", alpha = 0, beta = 1) @@ -590,6 +598,7 @@ test_that(desc = "(id: f3-v0.6.5-t9) Test Bayesian evaluation with different uni # jfa 0.7.0 test_that(desc = "(id: f3-v0.7.0-t1) Evaluation with stringer.poisson method", { + testthat::skip_on_cran() set.seed(1) population <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE), bookValue = runif(n = 1000, min = 100, max = 500)) jfaRes <- planning(conf.level = 0.95, materiality = 0.05, likelihood = "poisson") @@ -600,6 +609,7 @@ test_that(desc = "(id: f3-v0.7.0-t1) Evaluation with stringer.poisson method", { }) test_that(desc = "(id: f3-v0.7.0-t2) Evaluation with stringer.hypergeometric method", { + testthat::skip_on_cran() set.seed(1) population <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE), bookValue = runif(n = 1000, min = 100, max = 500)) jfaRes <- planning(conf.level = 0.95, materiality = 0.05, likelihood = "poisson") diff --git a/tests/testthat/test-ezquant.R b/tests/testthat/test-ezquant.R index 45f2dd1f4..69086a48b 100644 --- a/tests/testthat/test-ezquant.R +++ b/tests/testthat/test-ezquant.R @@ -19,6 +19,7 @@ context("Benchmark against EZ-quant software") # Retrieved on 02-03-2022 from https://www.dcaa.mil/Checklists-Tools/EZ-Quant-Applications/ test_that(desc = "(id: f12-v0.5.4-t1) Test Sample sizes for hypergeometric distribution", { + testthat::skip_on_cran() # Plan for 0 expected errors populationSize <- rep(c(rep(500, 4), rep(1000, 4), rep(5000, 4)), 3) tolerableErrorRate <- rep(rep(c(0.08, 0.06, 0.04, 0.02), times = 3), 3) diff --git a/tests/testthat/test-other.R b/tests/testthat/test-other.R index 6e62d1196..751f398ad 100644 --- a/tests/testthat/test-other.R +++ b/tests/testthat/test-other.R @@ -18,6 +18,7 @@ context("Validation of other functionality") # jfa version 0.5.0 test_that(desc = "(id: f4-v0.5.0-t1) Function test .markdown_call()", { + testthat::skip_on_cran() x <- .markdown_call("rmarkdown::render") expect_equal(length(x), 1) }) diff --git a/tests/testthat/test-samplingbook.R b/tests/testthat/test-samplingbook.R index 695a11e78..26db8adbb 100644 --- a/tests/testthat/test-samplingbook.R +++ b/tests/testthat/test-samplingbook.R @@ -18,6 +18,7 @@ context("Benchmark against R package samplingbook") # samplingbook R package (version 1.2.4) test_that(desc = "(id: f15-v0.6.3-t1) Validate hypergeometric 99% upper bounds", { + testthat::skip_on_cran() ub_level <- 0.99 interval_level <- ub_level - (1 - ub_level) index <- 1 @@ -38,6 +39,7 @@ test_that(desc = "(id: f15-v0.6.3-t1) Validate hypergeometric 99% upper bounds", }) test_that(desc = "(id: f15-v0.6.3-t2) Validate hypergeometric 95% upper bounds", { + testthat::skip_on_cran() ub_level <- 0.95 interval_level <- ub_level - (1 - ub_level) index <- 1 @@ -58,6 +60,7 @@ test_that(desc = "(id: f15-v0.6.3-t2) Validate hypergeometric 95% upper bounds", }) test_that(desc = "(id: f15-v0.6.3-t3) Validate hypergeometric 90% upper bounds", { + testthat::skip_on_cran() ub_level <- 0.90 interval_level <- ub_level - (1 - ub_level) index <- 1 diff --git a/tests/testthat/test-smash21.R b/tests/testthat/test-smash21.R index d3f621b2e..a007b063c 100644 --- a/tests/testthat/test-smash21.R +++ b/tests/testthat/test-smash21.R @@ -19,6 +19,7 @@ context("Benchmark against SMASH21 + SMASH21-Bayes") # Retrieved on 27-04-2021 from https://steekproeven.eu/wp-content/uploads/2021/01/SMASH21-PRO-kopie.xlsx test_that(desc = "(id: f13-v0.5.3-t1) Test frequentist sample sizes", { + testthat::skip_on_cran() theta <- c(1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000) / 20000 # materiality divided by N expected <- c(100, 200, 300, 400, 500, 600) / 20000 # exp.error divided by N sampleSizeMatrix <- matrix(NA, nrow = length(expected), ncol = length(theta)) @@ -48,6 +49,7 @@ test_that(desc = "(id: f13-v0.5.3-t1) Test frequentist sample sizes", { # Retrieved on 27-04-2021 from https://steekproeven.eu/wp-content/uploads/2021/01/SMASH21-Bayes-kopie.xlsx test_that(desc = "(id: f13-v0.5.3-t2) Test Bayesian sample sizes (N = 20,000)", { + testthat::skip_on_cran() N <- 20000 materiality <- 2000 / N expected <- c(300, 500, 700, 900, 1000) / N # 1.5%, 2.5%, 3.5%, 4.5%, 5% @@ -77,6 +79,7 @@ test_that(desc = "(id: f13-v0.5.3-t2) Test Bayesian sample sizes (N = 20,000)", }) test_that(desc = "(id: f13-v0.5.3-t3) Test Bayesian sample sizes (N = 100,000)", { + testthat::skip_on_cran() N <- 100000 materiality <- 6000 / N expected <- c(1000, 2000, 3000, 4000, 5000) / N # 1%, 2%, 3%, 4%, 5% diff --git a/tests/testthat/test-sra.R b/tests/testthat/test-sra.R index 7e1b5cc14..eccc107d1 100644 --- a/tests/testthat/test-sra.R +++ b/tests/testthat/test-sra.R @@ -39,6 +39,7 @@ context("Benchmark against SRA") # 0.99 | 93 47 31 24 19 16 14 12 11 10 test_that(desc = "(id: f13-v0.6.5-t1) Test frequentist sample sizes", { + testthat::skip_on_cran() theta <- c(1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000) / 20000 # materiality divided by N confidence <- c(0.95, 0.96, 0.97, 0.975, 0.98, 0.99) sampleSizeMatrix <- matrix(NA, nrow = length(confidence), ncol = length(theta)) diff --git a/tests/testthat/test-touwhoogduin.R b/tests/testthat/test-touwhoogduin.R index 48a2086ae..73a36ee38 100644 --- a/tests/testthat/test-touwhoogduin.R +++ b/tests/testthat/test-touwhoogduin.R @@ -37,6 +37,7 @@ context("Benchmark against Touw and Hoogduin (2011)") # 0.5 70 test_that(desc = "(id: f14-v0.5.1-t1) Test Sample sizes on page 17", { + testthat::skip_on_cran() SR <- c(0.05, 0.10, 0.25, 0.40, 0.50) materiality <- 0.01 n <- numeric(length(SR)) diff --git a/tests/testthat/test-workflow.R b/tests/testthat/test-workflow.R index cd9b502a5..8161664a7 100644 --- a/tests/testthat/test-workflow.R +++ b/tests/testthat/test-workflow.R @@ -18,6 +18,7 @@ context("Validation of workflow functionality") # jfa version 0.1.0 test_that(desc = "(id: f8-v0.1.0-t1) Test for workflow elements", { + testthat::skip_on_cran() set.seed(1) # Generate some audit data (N = 1000). population <- data.frame(ID = sample(1000:100000, size = 1000, replace = FALSE), bookValue = runif(n = 1000, min = 100, max = 500)) @@ -44,6 +45,7 @@ test_that(desc = "(id: f8-v0.1.0-t1) Test for workflow elements", { }) test_that(desc = "(id: f8-v0.1.0-t1) Test for use of jfaPrior and jfaPosterior", { + testthat::skip_on_cran() conf.level <- 0.90 # 90% conf.level tolerance <- 0.05 # 5% tolerance (materiality) # Construct a prior distribution @@ -62,6 +64,7 @@ test_that(desc = "(id: f8-v0.1.0-t1) Test for use of jfaPrior and jfaPosterior", }) test_that(desc = "(id: f8-v0.6.5-t1) Test for use of pipe in planning-selection", { + testthat::skip_on_cran() res <- planning(materiality = 0.03) |> selection(data = BuildIt) expect_equal(nrow(res[["sample"]]), 100) })