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 | f6ffe5d09034c83af8644c46311a60e79abc6a1f (patch) | |
| tree | 2a0462953cab2a58d7cc1d9e9fb952e41725b5df /test/ruby/test_complex.rb | |
| parent | 0a91b021fb96dbed61ae0ad113b8bdd43a85efc0 (diff) | |
| download | ruby-f6ffe5d09034c83af8644c46311a60e79abc6a1f.tar.gz ruby-f6ffe5d09034c83af8644c46311a60e79abc6a1f.tar.xz ruby-f6ffe5d09034c83af8644c46311a60e79abc6a1f.zip | |
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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_complex.rb')
| -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 2a193eb15..5d4916e1d 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 |
