mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 04:24:04 +02:00
numeric.c: Numeric#positive? and Numeric#negative?
* numeric.c (num_positive_p, num_negative_p): add methods Numeric#positive? and Numeric#negative?. [ruby-core:69173] [Feature #11151] * numeric.c (flo_positive_p, flo_negative_p): specialiazed functions for Float. * complex.c (Init_Complex): Complex do not have positive? and negative? methods git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1fbf1f7552
commit
932e916b9e
8 changed files with 163 additions and 0 deletions
|
@ -921,6 +921,16 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_raise(ZeroDivisionError, bug5713) { Rational(0, 1) ** Rational(-2,3) }
|
||||
end
|
||||
|
||||
def test_positive_p
|
||||
assert_predicate(1/2r, :positive?)
|
||||
assert_not_predicate(-1/2r, :positive?)
|
||||
end
|
||||
|
||||
def test_negative_p
|
||||
assert_predicate(-1/2r, :negative?)
|
||||
assert_not_predicate(1/2r, :negative?)
|
||||
end
|
||||
|
||||
def test_known_bug
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue