test_that("prev_table: One parameter is non-numeric", {
P <- 10
Q <- "Twenty"
R <- 30
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"Error: table parameter(s) are not of type 'numeric'."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"NA: prevalence table incomplete."
)
})
test_that("prev_table: Missing nref", {
P <- 10
Q <- NA
R <- 30
S <- NA
nexp <- 50
nref <- NA
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"Error: missing group totals."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"NA: prevalence table incomplete."
)
})
test_that("prev_table: Missing P", {
P <- NA
Q <- 20
R <- 30
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_neg_tot"
)
})
test_that("prev_table: Missing Q", {
P <- 10
Q <- NA
R <- 30
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_pos_tot"
)
})
test_that("prev_table: Missing P and R", {
P <- NA
Q <- 20
R <- NA
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_neg_tot"
)
})
test_that("prev_table: Missing P and Q", {
P <- NA
Q <- NA
R <- 30
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"Error: could not determine table type."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"NA: could not determine table type."
)
})
test_that("prev_table: Good pos total", {
P <- 10
Q <- NA
R <- 30
S <- NA
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_pos_tot"
)
})
test_that("prev_table: Good neg total", {
P <- NA
Q <- 20
R <- NA
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_neg_tot"
)
})
test_that("prev_table: Good full table", {
P <- 10
Q <- 20
R <- 30
S <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[2]],
"OK: parameters pass checks for prevalence table."
)
expect_identical(
validate_prevalence_table(P, Q, R, S, nexp, nref)[[3]],
"prev_table_pos_tot"
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.