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

test_that("default_min works correctly", {
  # Test with org_min > 0 and org_max > 1
  expect_equal(default_min(2, 100, 0.01, f = log10), log10(2))

  # Test with org_min == 0 and org_max < 1
  expect_equal(default_min(0, 0.5, 0.01, f = log10), log10(0.01 * 0.5))

  # Test with org_min == 0 and org_max > 1
  expect_equal(default_min(0, 100, 0.01, f = log10), log10(0.01))

  # Test with org_min > 0 and org_max < 1
  expect_equal(default_min(0.1, 0.5, 0.01, f = log10), log10(0.01))

  # Test with no transformation function
  expect_equal(default_min(2, 100, 0.01), 2)

  # Test with log transformation
  expect_equal(default_min(2, 100, 0.01, f = log), log(2))

  # Test with org_min == 0 and org_max == 0 (degenerate input never reached in the
  # pipeline; matches kwb.utils: org_max < 1 branch -> f(0.01 * 0) = f(0) = -Inf)
  expect_equal(default_min(0, 0, 0.01, f = log10), log10(0))
})
