diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 08:55:20 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 08:55:20 +0000 |
commit | 7580da68860930ec74d2f2d91a16f4e0ee89be97 (patch) | |
tree | 2a0462953cab2a58d7cc1d9e9fb952e41725b5df /test | |
parent | 4cef7e44c2fa2182f0c0b7798a9499ae0806cb21 (diff) |
merges r20474 from trunk into ruby_1_9_1.
* complex.c (nurat_{to_s,inspect}): provides better representation
for in-finite imag part.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index 2a193eb155..5d4916e1d0 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -564,6 +564,16 @@ class Complex_Test < Test::Unit::TestCase assert_equal('1-2/3i', Complex(1,Rational(-2,3)).to_s) assert_equal('-1-2/3i', Complex(-1,Rational(-2,3)).to_s) end + + nan = 0.0 / 0 + inf = 1.0 / 0 + if nan.nan? + assert_equal('NaN+NaN*i', Complex(nan,nan).to_s) + end + if inf.infinite? + assert_equal('Infinity+Infinity*i', Complex(inf,inf).to_s) + assert_equal('Infinity-Infinity*i', Complex(inf,-inf).to_s) + end end def test_inspect |