# File test/unit/assertions.rb, line 352 def assert_in_delta(expected_float, actual_float, delta, message="") _wrap_assertion { {expected_float => "first float", actual_float => "second float", delta => "delta"}.each { |float, name| assert_respond_to(float, :to_f, "The arguments must respond to to_f; the #{name} did not") } assert_operator(delta, :>=, 0.0, "The delta should not be negative") full_message = build_message(message, expected_float, actual_float, delta) { |arg1, arg2, arg3| "<#{arg1}> and\n" + "<#{arg2}> expected to be within\n" + "<#{arg3}> of each other" } assert_block(full_message) { (expected_float.to_f - actual_float.to_f).abs <= delta.to_f } } end