mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 22:45:03 +02:00
* bignum.c (Bignum#even?, Bignum#odd?): remove definitions
because they are unified with Integer#even? and Integer#odd?. * numeric.c (Fixnum#zero?, Fixnum#even?, Fixnum#odd?): remove definitions because they are unified with Numeric#zero?, Integer#even?, and Integer#odd?. * numeric.c (num_zero_p, int_even_p, int_odd_p): treat Fixnum and Bignum values directly. * test/ruby/test_integer.rb (test_odd_p_even_p): remove meaningless test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a3c9cda6d7
commit
aa1ea07d37
4 changed files with 33 additions and 27 deletions
|
@ -105,26 +105,6 @@ class TestInteger < Test::Unit::TestCase
|
|||
assert_predicate(1, :integer?)
|
||||
end
|
||||
|
||||
def test_odd_p_even_p
|
||||
Fixnum.class_eval do
|
||||
alias odd_bak odd?
|
||||
alias even_bak even?
|
||||
remove_method :odd?, :even?
|
||||
end
|
||||
|
||||
assert_predicate(1, :odd?)
|
||||
assert_not_predicate(2, :odd?)
|
||||
assert_not_predicate(1, :even?)
|
||||
assert_predicate(2, :even?)
|
||||
|
||||
ensure
|
||||
Fixnum.class_eval do
|
||||
alias odd? odd_bak
|
||||
alias even? even_bak
|
||||
remove_method :odd_bak, :even_bak
|
||||
end
|
||||
end
|
||||
|
||||
def test_succ
|
||||
assert_equal(2, 1.send(:succ))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue