@@ -177,13 +177,11 @@ fn check_remaining_demand_absolute_tolerance(
177177 "remaining_demand_absolute_tolerance must be a finite number greater than or equal to zero"
178178 ) ;
179179
180- // we already checked value is positive, but if they are
181- // increasing it above the default this is potentially dangerous.
182180 let default_value = default_remaining_demand_absolute_tolerance ( ) ;
183181 if !allow_broken_options {
184182 ensure ! (
185- value < = default_value,
186- "Setting a remaining_demand_absolute_tolerance higher than the default value of {:e} \
183+ value = = default_value,
184+ "Setting a remaining_demand_absolute_tolerance different from the default value of {:e} \
187185 is potentially dangerous, set please_give_me_broken_results to true \
188186 if you want to allow this.",
189187 default_value. 0
@@ -392,10 +390,10 @@ mod tests {
392390 }
393391
394392 #[ rstest]
395- #[ case( false , 0.0 , true ) ] // Valid minimum value (exactly zero)
393+ #[ case( true , 0.0 , true ) ] // Valid minimum value broken options allowed
396394 #[ case( true , 1e-10 , true ) ] // Valid value with broken options allowed
397395 #[ case( true , 1e-15 , true ) ] // Valid value with broken options allowed
398- #[ case( false , 1e-15 , true ) ] // Valid value below default, no broken options needed
396+ #[ case( false , 1e-12 , true ) ] // Valid value same as default, no broken options needed
399397 #[ case( true , 1.0 , true ) ] // Valid larger value with broken options allowed
400398 #[ case( true , f64 :: MAX , true ) ] // Valid maximum finite value with broken options allowed
401399 #[ case( true , -1e-10 , false ) ] // Invalid: negative value
@@ -423,10 +421,11 @@ mod tests {
423421 }
424422
425423 #[ rstest]
424+ #[ case( 0.0 ) ] // smaller than default
426425 #[ case( 1e-10 ) ] // Larger than default (1e-12)
427426 #[ case( 1.0 ) ] // Well above default
428427 #[ case( f64 :: MAX ) ] // Maximum finite value
429- fn check_remaining_demand_absolute_tolerance_requires_broken_options_above_default (
428+ fn check_remaining_demand_absolute_tolerance_requires_broken_options_if_non_default (
430429 #[ case] value : f64 ,
431430 ) {
432431 let flow = Flow :: new ( value) ;
@@ -435,7 +434,7 @@ mod tests {
435434 result,
436435 false ,
437436 value,
438- "Setting a remaining_demand_absolute_tolerance higher than the default value \
437+ "Setting a remaining_demand_absolute_tolerance different from the default value \
439438 of 1e-12 is potentially dangerous, set \
440439 please_give_me_broken_results to true if you want to allow this.",
441440 ) ;
0 commit comments