tests/testthat/test-helpers.R

test_that("handle_set works", {
  m_0 <- paste0("Nothing to amend, please specify a model to either add",
                " or drop that differs from the original set.")
  handle_set(c("nec4param", "nec3param"), add = "nec4param") |>
    expect_equal("wrong_model_output") |>
    expect_message(m_0)
  handle_set(c("nec4param", "nec3param")) |>
    expect_equal("wrong_model_output") |>
    expect_message(m_0)
  handle_set(c("nec4param", "nec3param"),
             drop = c("nec4param", "nec3param")) |>
    expect_error("All models removed, nothing to return")
  handle_set(c("nec4param", "nec3param"), add = c("ecx4param", "ecxlin")) |>
    expect_equal(c("nec4param", "nec3param", "ecx4param", "ecxlin"))
  handle_set(c("nec4param", "nec3param", "ecx4param",  "ecxlin"),
             drop = c("ecxlin", "nec4param", "nec3param")) |>
    expect_equal(c("ecx4param"))
})
AIMS/bayesnec documentation built on April 1, 2024, 8:51 p.m.