diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/integer_ext_test.rb (renamed from activesupport/test/core_ext/fixnum_ext_test.rb) | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/test/core_ext/fixnum_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index 66297fc378..4435bc79d3 100644 --- a/activesupport/test/core_ext/fixnum_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -1,7 +1,7 @@ require 'test/unit' -require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/fixnum' +require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/integer' -class FixnumExtTest < Test::Unit::TestCase +class IntegerExtTest < Test::Unit::TestCase def test_even assert [ -2, 0, 2, 4 ].all? { |i| i.even? } assert ![ -1, 1, 3 ].all? { |i| i.even? } @@ -15,11 +15,12 @@ class FixnumExtTest < Test::Unit::TestCase def test_odd assert ![ -2, 0, 2, 4 ].all? { |i| i.odd? } assert [ -1, 1, 3 ].all? { |i| i.odd? } + assert 1000000000000000000000000000000000000000000000000000000001.odd? end def test_multiple_of - assert [ -7, 0, 7, 14 ].all? { |i| i.multiple_of? 7 } - assert ![ -7, 0, 7, 14 ].all? { |i| i.multiple_of? 6 } + [ -7, 0, 7, 14 ].each { |i| assert i.multiple_of?(7) } + [ -7, 7, 14 ].each { |i| assert ! i.multiple_of?(6) } # test with a prime assert !22953686867719691230002707821868552601124472329079.multiple_of?(2) assert !22953686867719691230002707821868552601124472329079.multiple_of?(3) @@ -32,5 +33,6 @@ class FixnumExtTest < Test::Unit::TestCase # It's results are tested comprehensively in the inflector test cases. assert_equal '1st', 1.ordinalize assert_equal '8th', 8.ordinalize + 1000000000000000000000000000000000000000000000000000000000000000000000.ordinalize end end |