`ipla(...)` threw an unexpected error.
Message: need at least two non-NA values to interpolate
Class:   simpleError/error/condition

test_that("ipla validates inputs correctly", {
aging <- get("aging", envir = environment())
phenotype <- get("phenotype", envir = environment())
expect_error(ipla(aging, ga, phenotype, case, control, method, from, to), NA)
ipla(as.matrix(aging), ga, phenotype, case, control, method, from, to),
aging_missing_output <- aging[, -1, drop = FALSE]
ipla(aging_missing_output, ga, phenotype, case, control, method, from, to),
"'aging' must have a column named 'output'."
ipla(aging, as.matrix(ga), phenotype, case, control, method, from, to),
ga_missing_ga_column <- ga[, -1, drop = FALSE]
aging, ga_missing_ga_column, phenotype, case, control, method, from, to
ipla(aging, ga, as.matrix(phenotype), case, control, method, from, to),
"'phenotype' must be a data frame if provided."
# Test 'phenotype' missing 'phenotype' column
phenotype_missing_column <- phenotype[, -1, drop = FALSE]
ipla(aging, ga, phenotype_missing_column, case, control, method, from, to),
"'phenotype' must have a column named 'phenotype'."
ipla(aging, ga, phenotype, case = 123, control, method, from, to),
"'case' must be a single character string."
ipla(aging, ga, phenotype, case, control = 123, method, from, to),
"'control' must be a single character string."
aging, ga, phenotype, case, control, method = "InvalidMethod", from, to
"'method' must be either 'Mann-Whitney U' or 'Permutation' if provided."
ipla(aging, ga, phenotype, case, control, method, from = 50, to),
"'from' must be a single integer between 5 and 44."
ipla(aging, ga, phenotype, case, control, method, from, to = 50),
"'to' must be a single integer between 5 and 44."
ipla(aging, ga, phenotype, case, control, method, from = 20, to = 10),
ipla(aging, ga, phenotype, case, control, method = NULL, from, to), NA
# Test valid input with null 'from' and 'to'
ipla(aging, ga, phenotype, case, control, method, from = NULL, to = NULL)