Skip to content

@matthewl /testing_assert_in_delta.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
How to use assert_in_delta
require 'test/unit'
class TestAssertInDelta < Test::Unit::TestCase
def test_assert_in_delta
# Check that the calculated value is what we expect.
assert_in_delta(0.05, (5.0 / 100), 0.001)
# Check that the calculated value is still in range.
assert_in_delta(0.05, (5.1 / 100), 0.001)
# Great for testing the results of calculations.
assert_in_delta(33.333, ((9000 * 100.00) / (300 * 90.00)), 0.001)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.