[前][次][番号順一覧][スレッド一覧]

ruby-changes:35209

From: hsbt <ko1@a...>
Date: Tue, 26 Aug 2014 22:30:43 +0900 (JST)
Subject: [ruby-changes:35209] hsbt:r47291 (trunk): * test/ruby/test_complex.rb: cherry-picked working assertions from r47251.

hsbt	2014-08-26 22:30:35 +0900 (Tue, 26 Aug 2014)

  New Revision: 47291

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47291

  Log:
    * test/ruby/test_complex.rb: cherry-picked working assertions from r47251.
    * test/ruby/test_rational.rb: cherry-picked working assertions from r47263.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_complex.rb
    trunk/test/ruby/test_rational.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47290)
+++ ChangeLog	(revision 47291)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Aug 26 22:07:42 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* 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@t...>
 
 	* lib/mathn.rb (Fixnum#**, Bignum#**, Float#**, Rational#**):
Index: test/ruby/test_complex.rb
===================================================================
--- test/ruby/test_complex.rb	(revision 47290)
+++ test/ruby/test_complex.rb	(revision 47291)
@@ -205,8 +205,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L205
     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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L465
       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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L790
 
     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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L819
     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
Index: test/ruby/test_rational.rb
===================================================================
--- test/ruby/test_rational.rb	(revision 47290)
+++ test/ruby/test_rational.rb	(revision 47291)
@@ -173,8 +173,10 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L173
     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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]