refactor test_multiple_of

This commit is contained in:
Vijay Dev
2011-11-16 02:36:36 +05:30
parent c7ab43ff06
commit 83bf0b626c

View File

@@ -2,6 +2,8 @@ require 'abstract_unit'
require 'active_support/core_ext/integer'
class IntegerExtTest < Test::Unit::TestCase
PRIME = 22953686867719691230002707821868552601124472329079
def test_multiple_of
[ -7, 0, 7, 14 ].each { |i| assert i.multiple_of?(7) }
[ -7, 7, 14 ].each { |i| assert ! i.multiple_of?(6) }
@@ -11,10 +13,7 @@ class IntegerExtTest < Test::Unit::TestCase
assert !5.multiple_of?(0)
# test with a prime
assert !22953686867719691230002707821868552601124472329079.multiple_of?(2)
assert !22953686867719691230002707821868552601124472329079.multiple_of?(3)
assert !22953686867719691230002707821868552601124472329079.multiple_of?(5)
assert !22953686867719691230002707821868552601124472329079.multiple_of?(7)
[2, 3, 5, 7].each { |i| assert !PRIME.multiple_of?(i) }
end
def test_ordinalize