diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-21 06:16:11 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-21 06:16:11 +0000 |
commit | ed5723408dcb64467a6bd19bffe5768921407d45 (patch) | |
tree | ddb2c6a7c07ec285a9b89d0833c2f6d0bc8e398b /test | |
parent | f55f5a0d0ff6ad1868da85bb3f3ab15f1d97233e (diff) | |
download | ruby-ed5723408dcb64467a6bd19bffe5768921407d45.tar.gz |
Removed mathn.rb from stdlib. It's deprecated from Ruby 2.2.
[Feature #10169][[ruby-core:64553]]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 6 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_enum.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_range.rb | 11 | ||||
-rw-r--r-- | test/test_mathn.rb | 190 |
5 files changed, 0 insertions, 215 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 80ffc3fedd..7b720f4926 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1765,12 +1765,6 @@ class TestBigDecimal < Test::Unit::TestCase assert_kind_of(c, y) end - def test_to_d - bug6093 = '[ruby-core:42969]' - code = "exit(BigDecimal.new('10.0') == 10.0.to_d)" - assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093) - end - def test_bug6406 assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) Thread.current.keys.to_s diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index fbc0790f0f..d797ee8164 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2859,10 +2859,6 @@ class TestArray < Test::Unit::TestCase assert_raise(TypeError) {[0].sum("")} assert_raise(TypeError) {[1].sum("")} - - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal(6, [1r, 2, 3r].sum) - EOS end private diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 27d406680a..f44d025c09 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -907,10 +907,6 @@ class TestEnumerable < Test::Unit::TestCase assert_equal("abc", ["a", "b", "c"].each.sum("")) assert_equal([1, [2], 3], [[1], [[2]], [3]].each.sum([])) - - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal(6, [1r, 2, 3r].each.sum) - EOS end def test_hash_sum diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 1ce3f0663a..3743e9dda6 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -640,17 +640,6 @@ class TestRange < Test::Unit::TestCase assert_raise(TypeError) { ("a".."z").bsearch {} } end - def test_bsearch_with_mathn - assert_separately ['-r', 'mathn'], %q{ - msg = '[ruby-core:25740]' - answer = (1..(1 << 100)).bsearch{|x| - assert_predicate(x, :integer?, msg) - x >= 42 - } - assert_equal(42, answer, msg) - }, ignore_stderr: true - end - def test_each_no_blockarg a = "a" def a.upto(x, e, &b) diff --git a/test/test_mathn.rb b/test/test_mathn.rb deleted file mode 100644 index eb93895010..0000000000 --- a/test/test_mathn.rb +++ /dev/null @@ -1,190 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' - -# mathn redefines too much. It must be isolated to child processes. -class TestMathn < Test::Unit::TestCase - def test_power - stderr = $VERBOSE ? ["lib/mathn.rb is deprecated"] : [] - assert_in_out_err ['-r', 'mathn', '-e', 'a=1**2;!a'], "", [], stderr, '[ruby-core:25740]' - assert_in_out_err ['-r', 'mathn', '-e', 'a=(1 << 126)**2;!a'], "", [], stderr, '[ruby-core:25740]' - end - - def test_quo - stderr = $VERBOSE ? ["lib/mathn.rb is deprecated"] : [] - assert_in_out_err ['-r', 'mathn'], <<-EOS, %w(OK), stderr, '[ruby-core:41575]' - 1.quo(2); puts :OK - EOS - end - - def test_floor - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal( 2, ( 13/5).floor) - assert_equal( 2, ( 5/2).floor) - assert_equal( 2, ( 12/5).floor) - assert_equal(-3, (-12/5).floor) - assert_equal(-3, ( -5/2).floor) - assert_equal(-3, (-13/5).floor) - - assert_equal( 2, ( 13/5).floor(0)) - assert_equal( 2, ( 5/2).floor(0)) - assert_equal( 2, ( 12/5).floor(0)) - assert_equal(-3, (-12/5).floor(0)) - assert_equal(-3, ( -5/2).floor(0)) - assert_equal(-3, (-13/5).floor(0)) - - assert_equal(( 13/5), ( 13/5).floor(2)) - assert_equal(( 5/2), ( 5/2).floor(2)) - assert_equal(( 12/5), ( 12/5).floor(2)) - assert_equal((-12/5), (-12/5).floor(2)) - assert_equal(( -5/2), ( -5/2).floor(2)) - assert_equal((-13/5), (-13/5).floor(2)) - EOS - end - - def test_ceil - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal( 3, ( 13/5).ceil) - assert_equal( 3, ( 5/2).ceil) - assert_equal( 3, ( 12/5).ceil) - assert_equal(-2, (-12/5).ceil) - assert_equal(-2, ( -5/2).ceil) - assert_equal(-2, (-13/5).ceil) - - assert_equal( 3, ( 13/5).ceil(0)) - assert_equal( 3, ( 5/2).ceil(0)) - assert_equal( 3, ( 12/5).ceil(0)) - assert_equal(-2, (-12/5).ceil(0)) - assert_equal(-2, ( -5/2).ceil(0)) - assert_equal(-2, (-13/5).ceil(0)) - - assert_equal(( 13/5), ( 13/5).ceil(2)) - assert_equal(( 5/2), ( 5/2).ceil(2)) - assert_equal(( 12/5), ( 12/5).ceil(2)) - assert_equal((-12/5), (-12/5).ceil(2)) - assert_equal(( -5/2), ( -5/2).ceil(2)) - assert_equal((-13/5), (-13/5).ceil(2)) - EOS - end - - def test_truncate - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal( 2, ( 13/5).truncate) - assert_equal( 2, ( 5/2).truncate) - assert_equal( 2, ( 12/5).truncate) - assert_equal(-2, (-12/5).truncate) - assert_equal(-2, ( -5/2).truncate) - assert_equal(-2, (-13/5).truncate) - - assert_equal( 2, ( 13/5).truncate(0)) - assert_equal( 2, ( 5/2).truncate(0)) - assert_equal( 2, ( 12/5).truncate(0)) - assert_equal(-2, (-12/5).truncate(0)) - assert_equal(-2, ( -5/2).truncate(0)) - assert_equal(-2, (-13/5).truncate(0)) - - assert_equal(( 13/5), ( 13/5).truncate(2)) - assert_equal(( 5/2), ( 5/2).truncate(2)) - assert_equal(( 12/5), ( 12/5).truncate(2)) - assert_equal((-12/5), (-12/5).truncate(2)) - assert_equal(( -5/2), ( -5/2).truncate(2)) - assert_equal((-13/5), (-13/5).truncate(2)) - EOS - end - - def test_round - assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true) - assert_equal( 3, ( 13/5).round) - assert_equal( 3, ( 5/2).round) - assert_equal( 2, ( 12/5).round) - assert_equal(-2, (-12/5).round) - assert_equal(-3, ( -5/2).round) - assert_equal(-3, (-13/5).round) - - assert_equal( 3, ( 13/5).round(0)) - assert_equal( 3, ( 5/2).round(0)) - assert_equal( 2, ( 12/5).round(0)) - assert_equal(-2, (-12/5).round(0)) - assert_equal(-3, ( -5/2).round(0)) - assert_equal(-3, (-13/5).round(0)) - - assert_equal(( 13/5), ( 13/5).round(2)) - assert_equal(( 5/2), ( 5/2).round(2)) - assert_equal(( 12/5), ( 12/5).round(2)) - assert_equal((-12/5), (-12/5).round(2)) - assert_equal(( -5/2), ( -5/2).round(2)) - assert_equal((-13/5), (-13/5).round(2)) - - assert_equal( 3, ( 13/5).round(half: :even)) - assert_equal( 2, ( 5/2).round(half: :even)) - assert_equal( 2, ( 12/5).round(half: :even)) - assert_equal(-2, (-12/5).round(half: :even)) - assert_equal(-2, ( -5/2).round(half: :even)) - assert_equal(-3, (-13/5).round(half: :even)) - - assert_equal( 3, ( 13/5).round(0, half: :even)) - assert_equal( 2, ( 5/2).round(0, half: :even)) - assert_equal( 2, ( 12/5).round(0, half: :even)) - assert_equal(-2, (-12/5).round(0, half: :even)) - assert_equal(-2, ( -5/2).round(0, half: :even)) - assert_equal(-3, (-13/5).round(0, half: :even)) - - assert_equal(( 13/5), ( 13/5).round(2, half: :even)) - assert_equal(( 5/2), ( 5/2).round(2, half: :even)) - assert_equal(( 12/5), ( 12/5).round(2, half: :even)) - assert_equal((-12/5), (-12/5).round(2, half: :even)) - assert_equal(( -5/2), ( -5/2).round(2, half: :even)) - assert_equal((-13/5), (-13/5).round(2, half: :even)) - - assert_equal( 3, ( 13/5).round(half: :up)) - assert_equal( 3, ( 5/2).round(half: :up)) - assert_equal( 2, ( 12/5).round(half: :up)) - assert_equal(-2, (-12/5).round(half: :up)) - assert_equal(-3, ( -5/2).round(half: :up)) - assert_equal(-3, (-13/5).round(half: :up)) - - assert_equal( 3, ( 13/5).round(0, half: :up)) - assert_equal( 3, ( 5/2).round(0, half: :up)) - assert_equal( 2, ( 12/5).round(0, half: :up)) - assert_equal(-2, (-12/5).round(0, half: :up)) - assert_equal(-3, ( -5/2).round(0, half: :up)) - assert_equal(-3, (-13/5).round(0, half: :up)) - - assert_equal(( 13/5), ( 13/5).round(2, half: :up)) - assert_equal(( 5/2), ( 5/2).round(2, half: :up)) - assert_equal(( 12/5), ( 12/5).round(2, half: :up)) - assert_equal((-12/5), (-12/5).round(2, half: :up)) - assert_equal(( -5/2), ( -5/2).round(2, half: :up)) - assert_equal((-13/5), (-13/5).round(2, half: :up)) - - assert_equal( 3, ( 13/5).round(half: :down)) - assert_equal( 2, ( 5/2).round(half: :down)) - assert_equal( 2, ( 12/5).round(half: :down)) - assert_equal(-2, (-12/5).round(half: :down)) - assert_equal(-2, ( -5/2).round(half: :down)) - assert_equal(-3, (-13/5).round(half: :down)) - - assert_equal( 3, ( 13/5).round(0, half: :down)) - assert_equal( 2, ( 5/2).round(0, half: :down)) - assert_equal( 2, ( 12/5).round(0, half: :down)) - assert_equal(-2, (-12/5).round(0, half: :down)) - assert_equal(-2, ( -5/2).round(0, half: :down)) - assert_equal(-3, (-13/5).round(0, half: :down)) - - assert_equal(( 13/5), ( 13/5).round(2, half: :down)) - assert_equal(( 5/2), ( 5/2).round(2, half: :down)) - assert_equal(( 12/5), ( 12/5).round(2, half: :down)) - assert_equal((-12/5), (-12/5).round(2, half: :down)) - assert_equal(( -5/2), ( -5/2).round(2, half: :down)) - assert_equal((-13/5), (-13/5).round(2, half: :down)) - EOS - end - - def test_rational - assert_separately(%w[-rmathn], "#{<<-"begin;"}\n#{<<-"end;"}", ignore_stderr: true) - begin; - assert_equal(-5, "-5".to_r) - assert_equal(1, "5/5".to_r) - assert_equal(5, "5e0".to_r) - end; - end -end |