# Testing script the Conjunctive IU Test functions
# `calc_pwr_conj_test()`  - calculates power
# `calc_K_conj_test()`    - calculates # of clusters per treatment group
# `calc_m_conj_test()`    - calculates cluster size
test_that("Conjunctive IU test power works", {
expect_true(round(result, 3) == 0.899, info = paste(result))
# Test for Conjunctive IU test treatment group K
test_that("Conjunctive IU test treatment group 'K' works", {
# Test for Conjunctive IU test control group K
test_that("Conjunctive IU test control group 'K' works", {
test_that("Conjunctive IU test 'm' works", {
test_that("Conjunctive IU test K calculation aligns with power", {
result <- calc_K_conj_test(power = calc_pwr_conj_test(K = 15,
expect_true(result >= 14 & result <= 17,
info = "The result should be 15, but with rounding between 15 and 16")
expect_true(result >= 14.9 & result <= 16.1,
result <- calc_m_conj_test(power = calc_pwr_conj_test(m = 300,
expect_true(result >= 297 & result <= 304,
info = "The result should be 300, but with rounding between 298 and 303")
# test_that("Conjunctive IU power calculation aligns with GitHub source code", {
#   result1 <- round(calc_pwr_conj_test(m = 300,
#   result2 <- round(calPower_ttestIU(betas = c(0.1, 0.1),
#               info = paste0("Does not align with the original source code (", result1, " vs. ", result2, ")"))

"Conjunctive IU test treatment group 'K' works"
"Conjunctive IU test control group 'K' works"
"Conjunctive IU test K calculation aligns with power"
"The result should be 15, but with rounding between 15 and 16"
"The result should be 300, but with rounding between 298 and 303"

Conjunctive IU test K calculation aligns with power