Skip to content

Commit

Permalink
Skip many tests on CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Oct 4, 2023
1 parent df1bc00 commit f4a2865
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/testthat/test-MUS.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-aicpa-appendix-a.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-aicpa-appendix-c.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-audit-sampler.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-evaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-ezquant.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-other.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
3 changes: 3 additions & 0 deletions tests/testthat/test-samplingbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-smash21.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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%
Expand Down Expand Up @@ -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%
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-sra.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-touwhoogduin.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand All @@ -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)
})

0 comments on commit f4a2865

Please sign in to comment.