зеркало из https://github.com/github/ruby.git
Suppress too big exponent warnings
This commit is contained in:
Родитель
228ad7d84b
Коммит
64d79d333b
|
@ -105,14 +105,24 @@ describe :rational_exponent, shared: true do
|
||||||
# Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
|
# Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
|
||||||
platform_is_not :linux do
|
platform_is_not :linux do
|
||||||
it "returns positive Infinity when self < -1" do
|
it "returns positive Infinity when self < -1" do
|
||||||
(Rational(-2) ** bignum_value).infinite?.should == 1
|
-> {
|
||||||
(Rational(-2) ** (bignum_value + 1)).infinite?.should == 1
|
(Rational(-2) ** bignum_value).infinite?.should == 1
|
||||||
(Rational(fixnum_min) ** bignum_value).infinite?.should == 1
|
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||||
|
-> {
|
||||||
|
(Rational(-2) ** (bignum_value + 1)).infinite?.should == 1
|
||||||
|
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||||
|
-> {
|
||||||
|
(Rational(fixnum_min) ** bignum_value).infinite?.should == 1
|
||||||
|
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns 0.0 when self is < -1 and the exponent is negative" do
|
it "returns 0.0 when self is < -1 and the exponent is negative" do
|
||||||
(Rational(-2) ** -bignum_value).should eql(0.0)
|
-> {
|
||||||
(Rational(fixnum_min) ** -bignum_value).should eql(0.0)
|
(Rational(-2) ** -bignum_value).should eql(0.0)
|
||||||
|
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||||
|
-> {
|
||||||
|
(Rational(fixnum_min) ** -bignum_value).should eql(0.0)
|
||||||
|
}.should complain(/warning: in a\*\*b, b may be too big/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче