/vendor/gems/facets-2.4.5/test/core/numeric/test_approx.rb
Ruby | 13 lines | 10 code | 3 blank | 0 comment | 0 complexity | 1e36d9ead51ba3a5a4fbae382260ce01 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/numeric/approx'
- require 'test/unit'
- class TestRound < Test::Unit::TestCase
- def test_approx?
- f = 10.006
- assert( f.approx?(10.01) )
- assert( f.approx?(10, 0.1) )
- assert( 100.4.approx?(100.6, 1) )
- end
- end