ruby-changes:35181
From: hsbt <ko1@a...>
Date: Sun, 24 Aug 2014 11:44:42 +0900 (JST)
Subject: [ruby-changes:35181] hsbt:r47263 (trunk): * test/ruby/test_rational.rb: remove commented-out code.
hsbt 2014-08-24 11:44:34 +0900 (Sun, 24 Aug 2014) New Revision: 47263 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47263 Log: * test/ruby/test_rational.rb: remove commented-out code. Modified files: trunk/ChangeLog trunk/test/ruby/test_rational.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47262) +++ ChangeLog (revision 47263) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Aug 24 11:44:11 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * test/ruby/test_rational.rb: remove commented-out code. + Sun Aug 24 11:09:29 2014 Eric Wong <e@8...> * lib/benchmark.rb (measure): reduce allocations as in r47260 Index: test/ruby/test_rational.rb =================================================================== --- test/ruby/test_rational.rb (revision 47262) +++ test/ruby/test_rational.rb (revision 47263) @@ -179,49 +179,10 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L179 c = Rational(1) if @unify -=begin - assert_equal(true, c.finite?) - assert_equal(false, c.infinite?) - assert_equal(false, c.nan?) - assert_equal(true, c.integer?) - assert_equal(false, c.float?) - assert_equal(true, c.rational?) -=end assert_equal(true, c.real?) -=begin - assert_equal(false, c.complex?) - assert_equal(true, c.exact?) - assert_equal(false, c.inexact?) -=end else -=begin - assert_equal(true, c.finite?) - assert_equal(false, c.infinite?) - assert_equal(false, c.nan?) - assert_equal(false, c.integer?) - assert_equal(false, c.float?) - assert_equal(true, c.rational?) -=end assert_equal(true, c.real?) -=begin - assert_equal(false, c.complex?) - assert_equal(true, c.exact?) - assert_equal(false, c.inexact?) -=end - end - -=begin - assert_equal(true, Rational(0).positive?) - assert_equal(true, Rational(1).positive?) - assert_equal(false, Rational(-1).positive?) - assert_equal(false, Rational(0).negative?) - assert_equal(false, Rational(1).negative?) - assert_equal(true, Rational(-1).negative?) - - assert_equal(0, Rational(0).sign) - assert_equal(1, Rational(2).sign) - assert_equal(-1, Rational(-2).sign) -=end + end assert_equal(true, Rational(0).zero?) assert_equal(true, Rational(0,1).zero?) @@ -248,12 +209,6 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L209 assert_equal(Rational(1,1), -Rational(-1,1)) assert_equal(Rational(1,1), -Rational(1,-1)) assert_equal(Rational(-1,1), -Rational(-1,-1)) - -=begin - assert_equal(0, Rational(0).negate) - assert_equal(-2, Rational(2).negate) - assert_equal(2, Rational(-2).negate) -=end end def test_add @@ -422,43 +377,6 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L377 end end -=begin - def test_quot - c = Rational(1,2) - c2 = Rational(2,3) - - assert_eql(0, c.quot(c2)) - assert_eql(0, c.quot(2)) - assert_eql(0, c.quot(2.0)) - - c = Rational(301,100) - c2 = Rational(7,5) - - assert_equal(2, c.quot(c2)) - assert_equal(-2, c.quot(-c2)) - assert_equal(-2, (-c).quot(c2)) - assert_equal(2, (-c).quot(-c2)) - - c = Rational(301,100) - c2 = Rational(2) - - assert_equal(1, c.quot(c2)) - assert_equal(-1, c.quot(-c2)) - assert_equal(-1, (-c).quot(c2)) - assert_equal(1, (-c).quot(-c2)) - - unless @unify - c = Rational(11) - c2 = Rational(3) - - assert_equal(3, c.quot(c2)) - assert_equal(-3, c.quot(-c2)) - assert_equal(-3, (-c).quot(c2)) - assert_equal(3, (-c).quot(-c2)) - end - end -=end - def test_remainder c = Rational(1,2) c2 = Rational(2,3) @@ -494,43 +412,6 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L412 end end -=begin - def test_quotrem - c = Rational(1,2) - c2 = Rational(2,3) - - assert_eql([0, Rational(1,2)], c.quotrem(c2)) - assert_eql([0, Rational(1,2)], c.quotrem(2)) - assert_eql([0, 0.5], c.quotrem(2.0)) - - c = Rational(301,100) - c2 = Rational(7,5) - - assert_equal([2, Rational(21,100)], c.quotrem(c2)) - assert_equal([-2, Rational(21,100)], c.quotrem(-c2)) - assert_equal([-2, Rational(-21,100)], (-c).quotrem(c2)) - assert_equal([2, Rational(-21,100)], (-c).quotrem(-c2)) - - c = Rational(301,100) - c2 = Rational(2) - - assert_equal([1, Rational(101,100)], c.quotrem(c2)) - assert_equal([-1, Rational(101,100)], c.quotrem(-c2)) - assert_equal([-1, Rational(-101,100)], (-c).quotrem(c2)) - assert_equal([1, Rational(-101,100)], (-c).quotrem(-c2)) - - unless @unify - c = Rational(11) - c2 = Rational(3) - - assert_equal([3,2], c.quotrem(c2)) - assert_equal([-3,2], c.quotrem(-c2)) - assert_equal([-3,-2], (-c).quotrem(c2)) - assert_equal([3,-2], (-c).quotrem(-c2)) - end - end -=end - def test_quo c = Rational(1,2) c2 = Rational(2,3) @@ -848,29 +729,21 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L729 assert_equal(Rational(-5), '-5'.to_r) assert_equal(Rational(5,3), '5/3'.to_r) assert_equal(Rational(-5,3), '-5/3'.to_r) -# assert_equal(Rational(5,-3), '5/-3'.to_r) -# assert_equal(Rational(-5,-3), '-5/-3'.to_r) assert_equal(Rational(5), '5.0'.to_r) assert_equal(Rational(-5), '-5.0'.to_r) assert_equal(Rational(5,3), '5.0/3'.to_r) assert_equal(Rational(-5,3), '-5.0/3'.to_r) -# assert_equal(Rational(5,-3), '5.0/-3'.to_r) -# assert_equal(Rational(-5,-3), '-5.0/-3'.to_r) assert_equal(Rational(5), '5e0'.to_r) assert_equal(Rational(-5), '-5e0'.to_r) assert_equal(Rational(5,3), '5e0/3'.to_r) assert_equal(Rational(-5,3), '-5e0/3'.to_r) -# assert_equal(Rational(5,-3), '5e0/-3'.to_r) -# assert_equal(Rational(-5,-3), '-5e0/-3'.to_r) assert_equal(Rational(5e1), '5e1'.to_r) assert_equal(Rational(-5e2), '-5e2'.to_r) assert_equal(Rational(5e3,3), '5e003/3'.to_r) assert_equal(Rational(-5e4,3), '-5e004/3'.to_r) -# assert_equal(Rational(5e1,-3), '5e1/-3'.to_r) -# assert_equal(Rational(-5e2,-3), '-5e2/-3'.to_r) assert_equal(Rational(33,100), '.33'.to_r) assert_equal(Rational(33,100), '0.33'.to_r) @@ -892,29 +765,21 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L765 assert_equal(Rational(-5), Rational('-5')) assert_equal(Rational(5,3), Rational('5/3')) assert_equal(Rational(-5,3), Rational('-5/3')) -# assert_equal(Rational(5,-3), Rational('5/-3')) -# assert_equal(Rational(-5,-3), Rational('-5/-3')) assert_equal(Rational(5), Rational('5.0')) assert_equal(Rational(-5), Rational('-5.0')) assert_equal(Rational(5,3), Rational('5.0/3')) assert_equal(Rational(-5,3), Rational('-5.0/3')) -# assert_equal(Rational(5,-3), Rational('5.0/-3')) -# assert_equal(Rational(-5,-3), Rational('-5.0/-3')) assert_equal(Rational(5), Rational('5e0')) assert_equal(Rational(-5), Rational('-5e0')) assert_equal(Rational(5,3), Rational('5e0/3')) assert_equal(Rational(-5,3), Rational('-5e0/3')) -# assert_equal(Rational(5,-3), Rational('5e0/-3')) -# assert_equal(Rational(-5,-3), Rational('-5e0/-3')) assert_equal(Rational(5e1), Rational('5e1')) assert_equal(Rational(-5e2), Rational('-5e2')) assert_equal(Rational(5e3,3), Rational('5e003/3')) assert_equal(Rational(-5e4,3), Rational('-5e004/3')) -# assert_equal(Rational(5e1,-3), Rational('5e1/-3')) -# assert_equal(Rational(-5e2,-3), Rational('-5e2/-3')) assert_equal(Rational(33,100), Rational('.33')) assert_equal(Rational(33,100), Rational('0.33')) @@ -955,19 +820,6 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L820 assert_raise(ArgumentError){ Rational('5/3x')} end -=begin - def test_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).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 - def test_to_i assert_equal(1, Rational(3,2).to_i) assert_equal(1, Integer(Rational(3,2))) @@ -1109,13 +961,6 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L961 assert_equal(1.0, 1.0.denominator) assert_equal(1.0, 9.0.denominator) -=begin - assert_equal(Rational(1,9), 9.reciprocal) - assert_in_delta(0.1111, 9.0.reciprocal, 0.001) - assert_equal(Rational(1,9), 9.inverse) - assert_in_delta(0.1111, 9.0.inverse, 0.001) -=end - assert_equal(Rational(1,2), 1.quo(2)) assert_equal(Rational(5000000000), 10000000000.quo(2)) assert_equal(0.5, 1.0.quo(2)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/