///|
test "default limits accept ordinary input" {
  assert_true(parse_problem_json_with_limits("{}", Limits::default()) is Ok(_))
}

///|
test "strict input byte limit rejects oversized input" {
  let text = "{\"detail\":\"" + "x".repeat(20_000) + "\"}"
  assert_true(
    parse_problem_json_with_limits(text, Limits::strict())
    is Err(ProblemError(_, LimitExceeded, _, _)),
  )
}

///|
test "strict title limit rejects oversized title" {
  let text = "{\"title\":\"" + "x".repeat(600) + "\"}"
  assert_true(parse_problem_json_with_limits(text, Limits::strict()) is Err(_))
}

///|
test "strict detail limit rejects oversized detail" {
  let text = "{\"detail\":\"" + "x".repeat(5_000) + "\"}"
  assert_true(parse_problem_json_with_limits(text, Limits::strict()) is Err(_))
}

///|
test "nesting depth limit is forwarded to core parser" {
  assert_true(
    parse_problem_json_with_limits(
      "{\"x\":[[[[[[[[[[[[[[[[[1]]]]]]]]]]]]]]]]]}",
      Limits::strict(),
    )
    is Err(_),
  )
}

///|
test "default limits are tighter than permissive" {
  assert_true(
    Limits::default().max_input_bytes() < Limits::permissive().max_input_bytes(),
  )
}

///|
test "strict limits are tighter than default" {
  assert_true(Limits::strict().max_members() < Limits::default().max_members())
}

///|
test "limits expose positive bounds" {
  assert_true(
    Limits::default().max_string_bytes() > 0 &&
    Limits::default().max_nesting_depth() > 0,
  )
}