mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
refactor test_multiple_of
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user