mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merges r25067 from trunk into ruby_1_9_1 and added a test for it.
-- * lib/mathn.rb (Bignum#**): Fixed bignum**fixnum that was broken when requiring lib/mathn [ruby-core:25740] -- * test/test_mathn.rb (TestMathn): new test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aaa2752621
commit
319f97adb9
7 changed files with 25 additions and 7 deletions
|
|
@ -1,3 +1,9 @@
|
|||
Thu Sep 24 09:41:42 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/mathn.rb (Bignum#**): Fixed bignum**fixnum that was broken when
|
||||
requiring lib/mathn
|
||||
[ruby-core:25740]
|
||||
|
||||
Tue Sep 22 05:04:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/bigdecimal/lib/bigdecimal/{ludcmp,math}.rb: depend on
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Fixnum
|
|||
remove_method :/
|
||||
alias / quo
|
||||
|
||||
alias power! ** unless defined?(0.power!)
|
||||
alias power! ** unless method_defined? :power!
|
||||
|
||||
def ** (other)
|
||||
if self < 0 && other.round != other
|
||||
|
|
@ -41,7 +41,7 @@ class Bignum
|
|||
remove_method :/
|
||||
alias / quo
|
||||
|
||||
alias power! ** unless defined?(0.power!)
|
||||
alias power! ** unless method_defined? :power!
|
||||
|
||||
def ** (other)
|
||||
if self < 0 && other.round != other
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class Fixnum
|
|||
alias quof fdiv
|
||||
alias rdiv quo
|
||||
|
||||
alias power! ** unless defined?(0.power!)
|
||||
alias power! ** unless method_defined? :power!
|
||||
alias rpower **
|
||||
|
||||
end
|
||||
|
|
@ -13,7 +13,7 @@ class Bignum
|
|||
alias quof fdiv
|
||||
alias rdiv quo
|
||||
|
||||
alias power! ** unless defined?(0.power!)
|
||||
alias power! ** unless method_defined? :power!
|
||||
alias rpower **
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ class Complex_Test < Test::Unit::TestCase
|
|||
if @rational
|
||||
@keiju = Rational.instance_variable_get('@RCS_ID')
|
||||
end
|
||||
@unify = $".grep(/mathn/).size != 0
|
||||
seps = [File::SEPARATOR, File::ALT_SEPARATOR].compact.map{|x| Regexp.escape(x)}.join("|")
|
||||
@unify = $".grep(/(?:^|#{seps})mathn(?:\.(?:rb|so))?/).size != 0
|
||||
end
|
||||
|
||||
def test_compsub
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ class Rational_Test < Test::Unit::TestCase
|
|||
if @complex
|
||||
@keiju = Complex.instance_variable_get('@RCS_ID')
|
||||
end
|
||||
@unify = $".grep(/mathn/).size != 0
|
||||
seps = [File::SEPARATOR, File::ALT_SEPARATOR].compact.map{|x| Regexp.escape(x)}.join("|")
|
||||
@unify = $".grep(/(?:^|#{seps})mathn(?:\.(?:rb|so))?/).size != 0
|
||||
end
|
||||
|
||||
def test_ratsub
|
||||
|
|
|
|||
10
test/test_mathn.rb
Normal file
10
test/test_mathn.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
require 'test/unit'
|
||||
require_relative 'ruby/envutil'
|
||||
|
||||
# mathn redefines too much. It must be isolated to child processes.
|
||||
class TestMathn < Test::Unit::TestCase
|
||||
def test_power
|
||||
assert_in_out_err ['-r', 'mathn', '-e', '1**2'], [], [], [], '[ruby-core:25740]'
|
||||
assert_in_out_err ['-r', 'mathn', '-e', '(1<<126)**2'], [], [], [], '[ruby-core:25740]'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#define RUBY_VERSION "1.9.1"
|
||||
#define RUBY_PATCHLEVEL 350
|
||||
#define RUBY_PATCHLEVEL 351
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 9
|
||||
#define RUBY_VERSION_TEENY 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue