mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_complex.rb: cherry-picked working assertions from r47251.
* test/ruby/test_rational.rb: cherry-picked working assertions from r47263. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
63683cb46d
commit
618dadaaaa
3 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Aug 26 22:07:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||
|
||||
* test/ruby/test_complex.rb: cherry-picked working assertions from r47251.
|
||||
* test/ruby/test_rational.rb: cherry-picked working assertions from r47263.
|
||||
|
||||
Tue Aug 26 21:07:56 2014 gogo tanaka <mail@tanakakazuki.com>
|
||||
|
||||
* lib/mathn.rb (Fixnum#**, Bignum#**, Float#**, Rational#**):
|
||||
|
|
|
@ -205,8 +205,10 @@ class Complex_Test < Test::Unit::TestCase
|
|||
c = Complex(1)
|
||||
|
||||
if @unify
|
||||
assert_equal(true, c.integer?)
|
||||
assert_equal(true, c.real?)
|
||||
else
|
||||
assert_equal(false, c.integer?)
|
||||
assert_equal(false, c.real?)
|
||||
end
|
||||
|
||||
|
@ -463,7 +465,9 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_instance_of(Fixnum, Complex(1,2) - Complex(1,2))
|
||||
assert_instance_of(Fixnum, Complex(1,2) * 0)
|
||||
assert_instance_of(Fixnum, Complex(1,2) / Complex(1,2))
|
||||
assert_instance_of(Fixnum, Complex(1,2).div(Complex(1,2)))
|
||||
assert_instance_of(Fixnum, Complex(1,2).quo(Complex(1,2)))
|
||||
assert_instance_of(Fixnum, Complex(1,2) ** 0) # mathn's bug
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -786,6 +790,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
assert_equal(false, c.respond_to?(:positive?))
|
||||
assert_equal(false, c.respond_to?(:negative?))
|
||||
assert_equal(false, c.respond_to?(:sign))
|
||||
|
||||
assert_equal(false, c.respond_to?(:quotient))
|
||||
assert_equal(false, c.respond_to?(:quot))
|
||||
|
@ -814,6 +819,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(Rational(3), Complex(3).to_r)
|
||||
assert_equal(Rational(3), Rational(Complex(3)))
|
||||
assert_raise(RangeError){Complex(3,2).to_r}
|
||||
assert_raise(RangeError){Rational(Complex(3,2))}
|
||||
end
|
||||
|
||||
def test_to_c
|
||||
|
|
|
@ -173,8 +173,10 @@ class Rational_Test < Test::Unit::TestCase
|
|||
c = Rational(1)
|
||||
|
||||
if @unify
|
||||
assert_equal(true, c.integer?)
|
||||
assert_equal(true, c.real?)
|
||||
else
|
||||
assert_equal(false, c.integer?)
|
||||
assert_equal(true, c.real?)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue