Skip to content

Commit ada0564

Browse files
committed
tests added
1 parent 6abcbbb commit ada0564

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testthat/test-helper-fun.R

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,40 @@ test_that("Module registry", {
1717
expect_equal(typeof(mod), "list")
1818
expect_equal(length(mod), 4)
1919
})
20+
21+
## test calc_prop
22+
n <- seq(from = 1, to = 10, by = 1)
23+
theta <- seq(from = 0, to = 0.5, by = 0.1)
24+
xi <- seq(from = 0.1, to = 1, by = 0.1)
25+
alpha <- c(0.01, 0.025)
26+
save_path <- file.path("test_calc_prop.rds")
27+
suppressWarnings(suppressMessages(
28+
calcs_prop <- calc_prop(n, theta, xi, alpha, save_path)
29+
))
30+
test_that("Power calc proportions", {
31+
expect_equal(class(calcs_prop), "list")
32+
expect_equal(length(calcs_prop), 2)
33+
expect_equal(class(calcs_prop[[1]])[[1]], "powCalc")
34+
expect_true(file.exists(save_path))
35+
})
36+
37+
file.remove(save_path)
38+
39+
## test calc_t
40+
n <- seq(from = 1, to = 10, by = 1)
41+
theta <- seq(from = 0, to = 10, by = 1)
42+
xi <- seq(from = 1, to = 10, by = 1)
43+
alpha <- c(0.01, 0.025)
44+
type <- "paired"
45+
save_path <- file.path("test_calc_t.rds")
46+
suppressWarnings(suppressMessages(
47+
calcs_t <- calc_t(n, theta, xi, alpha, type, save_path)
48+
))
49+
test_that("Power calc proportions", {
50+
expect_equal(class(calcs_prop), "list")
51+
expect_equal(length(calcs_prop), 2)
52+
expect_equal(class(calcs_prop[[1]])[[1]], "powCalc")
53+
expect_true(file.exists(save_path))
54+
})
55+
56+
file.remove(save_path)

0 commit comments

Comments
 (0)