# WARNING - Generated by {fusen} from dev/flat_qmra.Rmd: do not edit by hand # nolint: line_length_linter.

test_that("run_qmra_custom works", {
  scenario <- create_scenario(system.file("input_1culture_2pop.xlsx", package = "ambre"))

regulation_reduction <- config_ambre$regulation$regulation_value |> 
  dplyr::filter(Country == "France") |>
  dplyr::select(-c(Concentration, Country, RegulationID))
regulation_concentration <- config_ambre$regulation$regulation_value |> 
  dplyr::filter(Country == "France") |>
  dplyr::select(-c(Country, RegulationID, Reduction))
concentration_custom <- data.frame(PathogenName = c("Rotavirus"),
                                   min = c(1),
                                   max = c(2),
                                   type = c("uniform"))
  result <- run_qmra_custom(scenario = scenario,
                  concentration = concentration_custom,
                  volume = data.frame(min=c(0.5,1), max = c(1,2), type= c("triangle", "triangle")),
                  frequency = c(200L, 300L),
                  regulationLog = regulation_reduction,
                  regulationConcentration = regulation_concentration,
                  initialSituation = TRUE)
  
  expect_equal(object = class(result),
               expected = "list")
  
  scenario = create_scenario(system.file("input_cas_apprentissage_complet.xlsx", package = "ambre"))
  n <- nrow(scenario)
  expect_error(object = run_qmra_custom(scenario = scenario,
                  concentration = concentration_custom,
                  volume = data.frame(min=rep(1, n), max = rep(2, n), type = rep("triangle", n)),
                  frequency = c(200L, 300L),
                  regulationLog = regulation_reduction,
                  regulationConcentration = regulation_concentration,
                  initialSituation = FALSE),
               regexp = "No value in column SupplementaryTreatmentName of the scenario") 
  
})
