diff --git a/tests/testthat/test-auditPrior.R b/tests/testthat/test-auditPrior.R index a86e21f2d..44eb2423d 100644 --- a/tests/testthat/test-auditPrior.R +++ b/tests/testthat/test-auditPrior.R @@ -46,6 +46,7 @@ test_that(desc = "(id: f2-v0.1.0-t2) Test for method = 'impartial'", { }) test_that(desc = "(id: f2-v0.1.0-t3) Test for method = 'hyp'", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "hyp", likelihood = "binomial", p.hmin = 0.3) expect_equal(prior[["description"]]$alpha, 1) expect_equal(prior[["description"]]$beta, 6.954, tolerance = 0.001) @@ -60,6 +61,7 @@ test_that(desc = "(id: f2-v0.1.0-t3) Test for method = 'hyp'", { }) test_that(desc = "(id: f2-v0.1.0-t4) Test for method = 'arm'", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "arm", likelihood = "binomial", ir = 0.6, cr = 0.6) expect_equal(prior[["description"]]$alpha, 1) expect_equal(prior[["description"]]$beta, 20, tolerance = 0.001) @@ -74,6 +76,7 @@ test_that(desc = "(id: f2-v0.1.0-t4) Test for method = 'arm'", { }) test_that(desc = "(id: f2-v0.1.0-t5) Test for method = 'sample'", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "sample", likelihood = "binomial", n = 30, x = 1) expect_equal(prior[["description"]]$alpha, 2) expect_equal(prior[["description"]]$beta, 29) @@ -88,6 +91,7 @@ test_that(desc = "(id: f2-v0.1.0-t5) Test for method = 'sample'", { }) test_that(desc = "(id: f2-v0.1.0-t6) Test for method = 'factor'", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "factor", likelihood = "binomial", n = 30, x = 1, factor = 0.6) expect_equal(prior[["description"]]$alpha, 1.6, tolerance = 0.001) expect_equal(prior[["description"]]$beta, 17.4, tolerance = 0.001) @@ -127,6 +131,7 @@ test_that(desc = "(id: f2-v0.4.0-t1) Test for method = 'impartial' with expected # jfa version 0.5.0 test_that(desc = "(id: f2-v0.5.0-t1) Test for summary and print function", { + testthat::skip_on_cran() prior <- auditPrior(conf.level = 0.95, likelihood = "binomial", method = "default") invisible(capture.output(print(prior))) invisible(capture.output(summary(prior))) @@ -135,6 +140,7 @@ test_that(desc = "(id: f2-v0.5.0-t1) Test for summary and print function", { }) test_that(desc = "(id: f2-v0.5.0-t2) Test for plot function", { + testthat::skip_on_cran() prior <- auditPrior(conf.level = 0.95, likelihood = "binomial", method = "default", materiality = 0.05) p <- plot(prior) expect_equal(is.null(prior), FALSE) @@ -154,6 +160,7 @@ test_that(desc = "(id: f2-v0.5.0-t2) Test for plot function", { # jfa version 0.5.3 test_that(desc = "(id: f2-v0.5.3-t1) Test for bram method binomial", { + testthat::skip_on_cran() N <- 20000 materiality <- 2000 expectedMisstatement <- 300 @@ -167,6 +174,7 @@ test_that(desc = "(id: f2-v0.5.3-t1) Test for bram method binomial", { }) test_that(desc = "(id: f2-v0.5.3-t2) Test for bram method poisson", { + testthat::skip_on_cran() N <- 20000 materiality <- 2000 expectedMisstatement <- 300 @@ -185,18 +193,21 @@ test_that(desc = "(id: f2-v0.5.3-t2) Test for bram method poisson", { # jfa version 0.6.0 test_that(desc = "(id: f2-v0.6.0-t1) Test for param method binomial", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, likelihood = "binomial", method = "param", alpha = 5, beta = 10) expect_equal(prior[["description"]]$alpha, 5) expect_equal(prior[["description"]]$beta, 10) }) test_that(desc = "(id: f2-v0.6.0-t2) Test for param method poisson", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, likelihood = "poisson", method = "param", alpha = 5, beta = 10) expect_equal(prior[["description"]]$alpha, 5) expect_equal(prior[["description"]]$beta, 10) }) test_that(desc = "(id: f2-v0.6.0-t1) Test for param method hypergeometric", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.05, likelihood = "hypergeometric", method = "param", alpha = 5, beta = 10, N = 100) expect_equal(prior[["description"]]$alpha, 5) expect_equal(prior[["description"]]$beta, 10) diff --git a/tests/testthat/test-digit-test.R b/tests/testthat/test-digit-test.R index 47c1e8b3b..8b8885ffb 100644 --- a/tests/testthat/test-digit-test.R +++ b/tests/testthat/test-digit-test.R @@ -16,6 +16,7 @@ context("Validation of function digit_test") test_that(desc = "Print and plot call", { + testthat::skip_on_cran() data("sinoForest") res <- digit_test(x = sinoForest$value, check = "first", reference = "benford") p <- plot(res) @@ -32,6 +33,7 @@ test_that(desc = "Validate Derks et al. (2020)", { }) test_that(desc = "Validate uniform distribution", { + testthat::skip_on_cran() res <- digit_test(x = 1:9, check = "first", reference = "uniform") expect_equal(as.numeric(res$n), 9) expect_equal(as.numeric(res$statistic), 0) @@ -40,6 +42,7 @@ test_that(desc = "Validate uniform distribution", { }) test_that(desc = "Validate benford.analysis package first digits", { + testthat::skip_on_cran() ba <- benford.analysis::benford(data = sinoForest$value, number.of.digits = 1) dt <- digit_test(x = sinoForest$value, check = "first") expect_equal(as.numeric(ba$bfd$data.dist.freq), as.numeric(dt$observed)) @@ -49,6 +52,7 @@ test_that(desc = "Validate benford.analysis package first digits", { }) test_that(desc = "Validate benford.analysis package first and second digits", { + testthat::skip_on_cran() ba <- benford.analysis::benford(data = sinoForest$value, number.of.digits = 2) dt <- digit_test(x = sinoForest$value, check = "firsttwo") expect_equal(as.numeric(ba$bfd$data.dist.freq), as.numeric(dt$observed)) @@ -58,6 +62,7 @@ test_that(desc = "Validate benford.analysis package first and second digits", { }) test_that(desc = "Validate BenfordTests package first digits", { + testthat::skip_on_cran() bt <- BenfordTests::chisq.benftest(x = sinoForest$value, digits = 1) dt <- digit_test(x = sinoForest$value, check = "first") expect_equal(as.numeric(bt$statistic), as.numeric(dt$statistic)) @@ -65,6 +70,7 @@ test_that(desc = "Validate BenfordTests package first digits", { }) test_that(desc = "Validate BeyondBenford package first digits", { + testthat::skip_on_cran() bb <- BeyondBenford::chi2(sinoForest$value, mod = "ben", dig = 1, pval = 1) dt <- digit_test(x = sinoForest$value, check = "first") expect_equal(as.numeric(bb$chi2[2]), as.numeric(dt$statistic)) @@ -78,11 +84,13 @@ test_that(desc = "Validate Derks et al. (2020)", { }) test_that(desc = "Validate uniform distribution", { + testthat::skip_on_cran() res <- digit_test(x = 1:9, check = "first", reference = "uniform", prior = TRUE) expect_equal(1 / as.numeric(res$bf), 22.77012458) }) test_that(desc = "Validate benford.analysis package", { + testthat::skip_on_cran() ba <- benford.analysis::benford(data = sinoForest$value, number.of.digits = 1) dt <- digit_test(x = sinoForest$value, check = "first") expect_equal(as.numeric(ba$bfd$data.dist.freq), as.numeric(dt$observed)) diff --git a/tests/testthat/test-evaluation.R b/tests/testthat/test-evaluation.R index c00d4ac7f..1b09b6d0e 100644 --- a/tests/testthat/test-evaluation.R +++ b/tests/testthat/test-evaluation.R @@ -89,6 +89,7 @@ test_that(desc = "(id: f3-v0.1.0-t7) Evaluation with stringer method", { }) test_that(desc = "(id: f3-v0.1.0-t8) Evaluation with stringer.meikle 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") @@ -105,6 +106,7 @@ test_that(desc = "(id: f3-v0.1.0-t8) Evaluation with stringer.meikle method", { }) test_that(desc = "(id: f3-v0.1.0-t9) Evaluation with stringer.lta 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") @@ -121,6 +123,7 @@ test_that(desc = "(id: f3-v0.1.0-t9) Evaluation with stringer.lta method", { }) test_that(desc = "(id: f3-v0.1.0-t10) Evaluation with stringer.pvz 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") @@ -137,6 +140,7 @@ test_that(desc = "(id: f3-v0.1.0-t10) Evaluation with stringer.pvz method", { }) test_that(desc = "(id: f3-v0.1.0-t11) Evaluation with rohrbach 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") @@ -147,6 +151,7 @@ test_that(desc = "(id: f3-v0.1.0-t11) Evaluation with rohrbach method", { }) test_that(desc = "(id: f3-v0.1.0-t12) Evaluation with moment 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") @@ -160,6 +165,7 @@ test_that(desc = "(id: f3-v0.1.0-t12) Evaluation with moment method", { }) test_that(desc = "(id: f3-v0.1.0-t13) Evaluation with direct method", { + testthat::skip_on_cran() data("BuildIt") BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) @@ -170,6 +176,7 @@ test_that(desc = "(id: f3-v0.1.0-t13) Evaluation with direct method", { }) test_that(desc = "(id: f3-v0.1.0-t14) Evaluation with difference method", { + testthat::skip_on_cran() data("BuildIt") BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) @@ -180,6 +187,7 @@ test_that(desc = "(id: f3-v0.1.0-t14) Evaluation with difference method", { }) test_that(desc = "(id: f3-v0.1.0-t15) Evaluation with quotient method", { + testthat::skip_on_cran() data("BuildIt") BuildIt$inSample <- c(rep(1, 100), rep(0, 3400)) BuildIt_sample <- subset(BuildIt, BuildIt$inSample == 1) @@ -200,6 +208,7 @@ test_that(desc = "(id: f3-v0.1.0-t16) Evaluation with regression method", { }) test_that(desc = "(id: f3-v0.1.0-t17) Evaluation with Cox and Snell 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, expected = 0.025) @@ -216,6 +225,7 @@ test_that(desc = "(id: f3-v0.1.0-t17) Evaluation with Cox and Snell method", { # jfa version 0.3.0 test_that(desc = "(id: f3-v0.3.0-t1) Evaluation with counts and stringer 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, expected = 0.025) @@ -250,6 +260,7 @@ test_that(desc = "(id: f3-v0.4.0-t1) Bayes factors", { # jfa version 0.5.0 test_that(desc = "(id: f3-v0.5.0-t1) Test for mpu estimator", { + testthat::skip_on_cran() sample <- data.frame(ID = 1:100, ist = rnorm(mean = 1000, n = 100)) sample$soll <- sample$ist sample$ist[1] <- 120 @@ -261,6 +272,7 @@ test_that(desc = "(id: f3-v0.5.0-t1) Test for mpu estimator", { }) test_that(desc = "(id: f3-v0.5.0-t1) Test for frequentist summary and print function", { + 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") @@ -280,6 +292,7 @@ test_that(desc = "(id: f3-v0.5.0-t1) Test for frequentist summary and print func }) test_that(desc = "(id: f3-v0.2.0-t2) Test for Bayesian summary function", { + 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") @@ -294,6 +307,7 @@ test_that(desc = "(id: f3-v0.2.0-t2) Test for Bayesian summary function", { }) test_that(desc = "(id: f3-v0.2.0-t4) Test for Bayesian plot function", { + 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)) samp <- selection(population, size = 100, units = "items", method = "random")$sample @@ -367,6 +381,7 @@ test_that(desc = "(id: f3-v0.6.0-t2) Test Bayes factors for gamma prior", { }) test_that(desc = "(id: f3-v0.6.0-t3) Test Bayes factors for beta-binomial prior", { + testthat::skip_on_cran() # Compute a Bayes factor from a noninformative beta-binomial prior BF <- evaluation(materiality = 0.03, n = 160, x = 1, prior = auditPrior(method = "default", likelihood = "hypergeometric", N.units = 1000))$posterior$hypotheses$bf.h1 expect_equal(BF, 943.4715321) @@ -540,6 +555,7 @@ test_that(desc = "(id: f3-v0.6.5-t6) Validate poststratification with stan examp }) test_that(desc = "(id: f3-v0.6.5-t7) Test evaluation with non-conjugate priors", { + testthat::skip_on_cran() # Cannot test for consistency due to sampling differences on OS's prior <- auditPrior(method = "param", likelihood = "normal", alpha = 0.025, beta = 0.05) res <- evaluation(materiality = 0.03, x = 0, n = 53, prior = prior, method = "binomial") diff --git a/tests/testthat/test-model-fairness.R b/tests/testthat/test-model-fairness.R index 6e584de90..dc305530d 100644 --- a/tests/testthat/test-model-fairness.R +++ b/tests/testthat/test-model-fairness.R @@ -16,6 +16,7 @@ context("Validation of function model_fairness") test_that(desc = "Benchmark against fairness package", { + testthat::skip_on_cran() data("compas") # Demographic parity jfa_dp <- model_fairness(compas, "Ethnicity", "TwoYrRecidivism", "Predicted", privileged = "Caucasian", positive = "yes", metric = "dp") diff --git a/tests/testthat/test-planning.R b/tests/testthat/test-planning.R index f2d10c1e1..4318fef96 100644 --- a/tests/testthat/test-planning.R +++ b/tests/testthat/test-planning.R @@ -24,18 +24,21 @@ test_that(desc = "(id: f5-v0.1.0-t1) Frequentist Poisson 1% materiality", { }) test_that(desc = "(id: f5-v0.1.0-t2) Frequentist Poisson 5% materiality", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0, likelihood = "poisson") expect_equal(jfaRes[["n"]], 60) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.1.0-t3) Frequentist Poisson 5% materiality 2.5% errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.025, likelihood = "poisson") expect_equal(jfaRes[["n"]], 231) expect_equal(jfaRes[["x"]], 5.78, tolerance = 0.001) }) test_that(desc = "(id: f5-v0.1.0-t4) Frequentist Poisson 5% materiality 2% errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 2, likelihood = "poisson") expect_equal(jfaRes[["n"]], 126) expect_equal(jfaRes[["x"]], 2) @@ -48,30 +51,35 @@ test_that(desc = "(id: f5-v0.1.0-t5) Bayesian Poisson 5% materiality 2.5% errors }) test_that(desc = "(id: f5-v0.1.0-t7) Frequentist binomial 1% materiality", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.01, conf.level = 0.95, expected = 0, likelihood = "binomial") expect_equal(jfaRes[["n"]], 299) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.1.0-t8) Frequentist binomial 5% materiality", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0, likelihood = "binomial") expect_equal(jfaRes[["n"]], 59) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.1.0-t9) Frequentist binomial 5% materiality 2.5% errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.025, likelihood = "binomial") expect_equal(jfaRes[["n"]], 234) expect_equal(jfaRes[["x"]], 6, tolerance = 0.001) }) test_that(desc = "(id: f5-v0.1.0-t10) Frequentist binomial 5% materiality 2 errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 2, likelihood = "binomial") expect_equal(jfaRes[["n"]], 124) expect_equal(jfaRes[["x"]], 2) }) test_that(desc = "(id: f5-v0.1.0-t11) Bayesian binomial 5% materiality 2.5% errors", { + testthat::skip_on_cran() prior <- auditPrior(method = "default", likelihood = "binomial") jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.025, likelihood = "binomial", prior = prior) expect_equal(jfaRes[["n"]], 220) @@ -79,30 +87,35 @@ test_that(desc = "(id: f5-v0.1.0-t11) Bayesian binomial 5% materiality 2.5% erro }) test_that(desc = "(id: f5-v0.1.0-t13) Frequentist hypergeometric 1% materiality", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.01, conf.level = 0.95, expected = 0, likelihood = "hypergeometric", N.units = 1000) expect_equal(jfaRes[["n"]], 258) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.1.0-t14) Frequentist hypergeometric 5% materiality", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0, likelihood = "hypergeometric", N.units = 1000) expect_equal(jfaRes[["n"]], 57) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.1.0-t15) Frequentist hypergeometric 5% materiality 2.5% errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.025, likelihood = "hypergeometric", N.units = 1000) expect_equal(jfaRes[["n"]], 197) expect_equal(jfaRes[["x"]], 5) }) test_that(desc = "(id: f5-v0.1.0-t16) Frequentist hypergeometric 5% materiality 2 errors", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 2, likelihood = "hypergeometric", N.units = 1000) expect_equal(jfaRes[["n"]], 119) expect_equal(jfaRes[["x"]], 2) }) test_that(desc = "(id: f5-v0.1.0-t17) Bayesian hypergeometric 5% materiality 2.5% errors", { + testthat::skip_on_cran() prior <- auditPrior(method = "default", likelihood = "hypergeometric", N.units = 1000) jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.025, likelihood = "hypergeometric", N.units = 1000, prior = prior) expect_equal(jfaRes[["n"]], 196) @@ -110,6 +123,7 @@ test_that(desc = "(id: f5-v0.1.0-t17) Bayesian hypergeometric 5% materiality 2.5 }) test_that(desc = "(id: f5-v0.1.0-t19) Bayesian binomial 2% precision 5% materiality 2.5% errors impartial prior", { + testthat::skip_on_cran() jfaPrior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "impartial", expected = 0.025, likelihood = "binomial") jfaRes <- planning(materiality = 0.05, min.precision = 0.02, conf.level = 0.95, expected = 0.025, likelihood = "binomial", N.units = 1000, prior = jfaPrior) expect_equal(jfaRes[["n"]], 284) @@ -117,6 +131,7 @@ test_that(desc = "(id: f5-v0.1.0-t19) Bayesian binomial 2% precision 5% material }) test_that(desc = "(id: f5-v0.1.0-t20) Bayesian binomial 5% materiality 1% errors hypotheses prior", { + testthat::skip_on_cran() jfaPrior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "hyp", p.hmin = 0.7, likelihood = "binomial") jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.01, likelihood = "binomial", N.units = 1000, prior = jfaPrior) expect_equal(jfaRes[["n"]], 55) @@ -124,6 +139,7 @@ test_that(desc = "(id: f5-v0.1.0-t20) Bayesian binomial 5% materiality 1% errors }) test_that(desc = "(id: f5-v0.1.0-t21) Bayesian poisson 5% materiality 1% errors factor prior", { + testthat::skip_on_cran() jfaPrior <- auditPrior(materiality = 0.05, conf.level = 0.95, method = "factor", factor = 0.6, n = 58, x = 0, expected = 0.025, likelihood = "binomial") jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0.01, likelihood = "binomial", N.units = 1000, prior = jfaPrior) expect_equal(jfaRes[["n"]], 38) @@ -131,6 +147,7 @@ test_that(desc = "(id: f5-v0.1.0-t21) Bayesian poisson 5% materiality 1% errors }) test_that(desc = "(id: f5-v0.1.0-t22) Bayesian poisson 3% materiality 1.3% errors sample prior", { + testthat::skip_on_cran() jfaPrior <- auditPrior(materiality = 0.03, conf.level = 0.95, method = "sample", n = 58, x = 0, expected = 0.025, likelihood = "binomial") jfaRes <- planning(materiality = 0.03, conf.level = 0.95, expected = 0.013, likelihood = "binomial", N.units = 1000, prior = jfaPrior) expect_equal(jfaRes[["n"]], 143) @@ -138,6 +155,7 @@ test_that(desc = "(id: f5-v0.1.0-t22) Bayesian poisson 3% materiality 1.3% error }) test_that(desc = "(id: f5-v0.1.0-t23) Frequentist poisson 3% materiality 1.3% errors 5% min precision", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.03, conf.level = 0.95, expected = 0.013, min.precision = 0.05, likelihood = "binomial", N.units = 1000) expect_equal(jfaRes[["n"]], 303) expect_equal(jfaRes[["x"]], 4, tolerance = 0.001) @@ -146,6 +164,7 @@ test_that(desc = "(id: f5-v0.1.0-t23) Frequentist poisson 3% materiality 1.3% er # jfa version 0.2.0 test_that(desc = "(id: f5-v0.2.0-t1) Bayesian poisson 3% materiality 1.3% errors 5% min precision standard prior", { + testthat::skip_on_cran() prior <- auditPrior(method = "default", likelihood = "binomial") jfaRes <- planning(materiality = 0.03, conf.level = 0.95, expected = 0.013, min.precision = 0.05, likelihood = "binomial", N.units = 1000, prior = prior) expect_equal(jfaRes[["n"]], 293) @@ -153,12 +172,14 @@ test_that(desc = "(id: f5-v0.2.0-t1) Bayesian poisson 3% materiality 1.3% errors }) test_that(desc = "(id: f5-v0.2.0-t2) Bayesian poisson 100% materiality 0% errors 2% min precision standard prior", { + testthat::skip_on_cran() jfaRes <- planning(conf.level = 0.95, min.precision = 0.02, likelihood = "poisson", prior = TRUE) expect_equal(jfaRes[["n"]], 149) expect_equal(jfaRes[["x"]], 0) }) test_that(desc = "(id: f5-v0.2.0-t3) Bayesian poisson 100% materiality 1% errors 2% min precision standard prior", { + testthat::skip_on_cran() jfaRes <- planning(conf.level = 0.95, min.precision = 0.02, expected = 0.01, likelihood = "poisson", prior = TRUE) expect_equal(jfaRes[["n"]], 219) expect_equal(jfaRes[["x"]], 2.19, tolerance = 0.001) @@ -170,6 +191,7 @@ test_that(desc = "(id: f5-v0.2.0-t3) Bayesian poisson 100% materiality 1% errors # jfa version 0.4.0 test_that(desc = "(id: f5-v0.4.0-t1) Expected Bayes factors for zero expected errors", { + testthat::skip_on_cran() prior <- auditPrior(method = "strict", likelihood = "poisson") jfaRes <- planning(conf.level = 0.95, materiality = 0.02, expected = 0, likelihood = "poisson", prior = prior) expect_equal(jfaRes[["posterior"]][["hypotheses"]]$odds.h1, 19.08554, tolerance = 0.001) @@ -184,6 +206,7 @@ test_that(desc = "(id: f5-v0.4.0-t1) Expected Bayes factors for zero expected er }) test_that(desc = "(id: f5-v0.4.0-t2) Expected Bayes factors for expected errors > 0", { + testthat::skip_on_cran() prior <- auditPrior(method = "strict", likelihood = "poisson") jfaRes <- planning(conf.level = 0.95, materiality = 0.02, expected = 0.01, likelihood = "poisson", prior = prior) expect_equal(jfaRes[["posterior"]][["hypotheses"]]$odds.h1, 19.01191777, tolerance = 0.001) @@ -198,6 +221,7 @@ test_that(desc = "(id: f5-v0.4.0-t2) Expected Bayes factors for expected errors }) test_that(desc = "(id: f5-v0.4.0-t3) Expected Bayes factors for impartial priors", { + testthat::skip_on_cran() prior <- auditPrior(materiality = 0.02, conf.level = 0.95, method = "impartial", likelihood = "poisson") jfaRes <- planning(conf.level = 0.95, materiality = 0.02, prior = prior) expect_equal(jfaRes[["posterior"]][["hypotheses"]]$bf.h1, 19.35135, tolerance = 0.001) @@ -210,6 +234,7 @@ test_that(desc = "(id: f5-v0.4.0-t3) Expected Bayes factors for impartial priors # jfa version 0.5.0 test_that(desc = "(id: f5-v0.5.0-t1) Test for frequentist summary and print function", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.01, conf.level = 0.95, expected = 0, likelihood = "poisson") invisible(capture.output(print(jfaRes))) invisible(capture.output(summary(jfaRes))) @@ -218,6 +243,7 @@ test_that(desc = "(id: f5-v0.5.0-t1) Test for frequentist summary and print func }) test_that(desc = "(id: f5-v0.5.0-t2) Test for Bayesian summary and print function", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.01, conf.level = 0.95, expected = 0, likelihood = "poisson", prior = TRUE) invisible(capture.output(print(jfaRes))) invisible(capture.output(summary(jfaRes))) @@ -228,6 +254,7 @@ test_that(desc = "(id: f5-v0.5.0-t2) Test for Bayesian summary and print functio }) test_that(desc = "(id: f5-v0.5.0-t4) Test for Bayesian plot function", { + testthat::skip_on_cran() jfaRes <- planning(min.precision = 0.02, conf.level = 0.95, expected = 0, likelihood = "poisson", prior = TRUE) p <- plot(jfaRes) expect_equal(is.null(p), FALSE) @@ -259,6 +286,7 @@ test_that(desc = "(id: f5-v0.5.0-t4) Test for Bayesian plot function", { # jfa version 0.5.2 test_that(desc = "(id: f5-v0.5.2-t1) Test for change in Hypergeometric mode calculation", { + testthat::skip_on_cran() jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0, likelihood = "hypergeometric", N.units = 10000) modeDist <- ceiling((jfaRes[["ub"]] - jfaRes[["precision"]]) * 10000) expect_equal(jfaRes[["n"]], 59) @@ -266,6 +294,7 @@ test_that(desc = "(id: f5-v0.5.2-t1) Test for change in Hypergeometric mode calc }) test_that(desc = "(id: f5-v0.5.2-t2) Test for change in beta-binomial mode calculation", { + testthat::skip_on_cran() prior <- auditPrior(method = "default", likelihood = "hypergeometric", N.units = 10000) jfaRes <- planning(materiality = 0.05, conf.level = 0.95, expected = 0, likelihood = "hypergeometric", N = 10000, prior = prior) modeDist <- ceiling((jfaRes[["ub"]] - jfaRes[["precision"]]) * 10000) @@ -279,6 +308,7 @@ test_that(desc = "(id: f5-v0.5.2-t2) Test for change in beta-binomial mode calcu # jfa version 0.6.5 test_that(desc = "(id: f5-v0.6.5-t1) Test Bayesian planning 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) diff --git a/tests/testthat/test-repeated-values.R b/tests/testthat/test-repeated-values.R index 9eb2e8c8e..ed4282a68 100644 --- a/tests/testthat/test-repeated-values.R +++ b/tests/testthat/test-repeated-values.R @@ -16,6 +16,7 @@ context("Validation of function repeated_test") test_that(desc = "Print and plot call", { + testthat::skip_on_cran() data("sanitizer") res <- repeated_test(x = sanitizer$value, check = "last", method = "af", samples = 1) # Adjusted from 500 to 1 for check time control p <- plot(res) @@ -23,6 +24,7 @@ test_that(desc = "Print and plot call", { }) test_that(desc = "Validate Datacolada[77]", { + testthat::skip_on_cran() data("sanitizer") res <- repeated_test(x = sanitizer$value, check = "last", method = "af", samples = 1) # Adjusted from 500 to 1 for check time control expect_equal(as.numeric(res$statistic), 1.5225)