Sha256: b3fd5f14d531ed006106eecce4ec8b841b6264b317ff24bfb46de6027a742f40
Contents?: true
Size: 1019 Bytes
Versions: 1
Compression:
Stored size: 1019 Bytes
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/core/float/round_to.rb # # Extracted Tue Jul 25 10:07:15 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/core/float/round_to.rb' require 'test/unit' class TCFloat < Test::Unit::TestCase def setup @f0 = [ 0, 10, 15, 105 ] @f1 = [ 10.1, 10.01, 10.9, 10.09, 10.5, 10.05, 10.49 ] end def test_round_to_arg1 fr = @f0.collect { |f| f.round_to(0.1) } assert_equal( [0,10,15,105], fr ) fr = @f1.collect { |f| f.round_to(0.1) } assert_equal( [10.1,10.0,10.9,10.1,10.5,10.1,10.5], fr ) end def test_round_to_arg10 fr = @f0.collect { |f| f.round_to(10) } assert_equal( [0,10,20,110], fr ) fr = @f1.collect { |f| f.round_to(10) } assert_equal( [10,10,10,10,10,10,10], fr ) end def test_round_off assert_equal( 1.0, 1.2.round_off ) assert_equal( 2.0, 1.8.round_off ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-1.7.0 | test/lib/facets/core/float/test_round_to.rb |