diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 11:51:04 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 11:51:04 +0000 |
commit | 1d9a079b1c3b54da5935201c796c7cdb423ed4c8 (patch) | |
tree | 3d901adc26cf5a33ef274e10843560cf8f80313a /test/ruby | |
parent | 8aae9dc62c4c32219be8bb2afd731a8cafb32b0a (diff) | |
download | ruby-1d9a079b1c3b54da5935201c796c7cdb423ed4c8.tar.gz |
* complex.c (numeric_abs2): new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_complex.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_rational.rb | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index 145306ed2a..b797ec10d0 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -856,6 +856,11 @@ class Complex_Test < Test::Unit::TestCase assert_equal(1, 1.0.magnitude) assert_equal(1, -1.0.magnitude) + assert_equal(4, 2.abs2) + assert_equal(4, -2.abs2) + assert_equal(4.0, 2.0.abs2) + assert_equal(4.0, -2.0.abs2) + assert_equal(0, 1.arg) assert_equal(0, 1.angle) assert_equal(0, 1.phase) diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index ece44a9051..c5855a0345 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -953,6 +953,10 @@ class Rational_Test < Test::Unit::TestCase assert_equal(Rational(9,1), Rational(1,9).reciprocal) assert_equal(Rational(-1,9), Rational(-9,1).reciprocal) assert_equal(Rational(-9,1), Rational(-1,9).reciprocal) + assert_equal(Rational(1,9), Rational(9,1).inverse) + assert_equal(Rational(9,1), Rational(1,9).inverse) + assert_equal(Rational(-1,9), Rational(-9,1).inverse) + assert_equal(Rational(-9,1), Rational(-1,9).inverse) end =end @@ -1047,9 +1051,9 @@ class Rational_Test < Test::Unit::TestCase =begin assert_equal(Rational(1,9), 9.reciprocal) - assert_equal(Rational(1,9), 9.0.reciprocal) + assert_in_delta(0.1111, 9.0.reciprocal, 0.001) assert_equal(Rational(1,9), 9.inverse) - assert_equal(Rational(1,9), 9.0.inverse) + assert_in_delta(0.1111, 9.0.inverse, 0.001) =end assert_equal(Rational(1,2), 1.quo(2)) |