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

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

  result <- purrr::pmap(
  list(
    config = scenario_example$config,
    barrierID = scenario_example$SupplementaryProcessID,
    matrixID = scenario_example$MatrixID,
    popID = scenario_example$PopulationID
  ),
  function(config, barrierID, matrixID, popID) {

    if (barrierID %in% c(9,13,14,15,16,17,18,24,26,27,28)) {

      update_logreduction_path(
        config = config,
        matrixID = matrixID,
        barrierID = barrierID,
        popID = popID
      )

    } else {
      config
    }
  }
)
  
  difference_min_value <- scenario_example$config[[1]]$treatment$processes[76, ]$min - result[[1]]$treatment$processes[76, ]$min
  difference_max_value <- scenario_example$config[[1]]$treatment$processes[76, ]$max - result[[1]]$treatment$processes[76, ]$max
  
  expect_equal(object = difference_min_value,
               expected = 0) 
  
  expect_equal(object = difference_max_value,
               expected = 3)

})
