From f6ffe5d09034c83af8644c46311a60e79abc6a1f Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 4 Dec 2008 08:55:20 +0000 Subject: 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 --- test/ruby/test_complex.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') 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 -- cgit