Created
December 9, 2011 22:24
-
-
Save jfirebaugh/1453587 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby_bug "#5713", "2.0" do | |
| it "returns Rational(0) when self is Rational(0) and the exponent is positive" do | |
| (Rational(0) ** bignum_value).should eql(Rational(0)) | |
| end | |
| it "raises ZeroDivisionError when self is Rational(0) and the exponent is negative" do | |
| lambda { Rational(0) ** -bignum_value }.should raise_error(ZeroDivisionError) | |
| end | |
| it "returns Rational(1) when self is Rational(1)" do | |
| (Rational(1) ** bignum_value).should eql(Rational(1)) | |
| (Rational(1) ** -bignum_value).should eql(Rational(1)) | |
| end | |
| it "returns Rational(1) when self is Rational(-1) and the exponent is even" do | |
| (Rational(-1) ** bignum_value(0)).should eql(Rational(1)) | |
| (Rational(-1) ** bignum_value(2)).should eql(Rational(1)) | |
| end | |
| it "returns Rational(-1) when self is Rational(-1) and the exponent is odd" do | |
| (Rational(-1) ** bignum_value(1)).should eql(Rational(-1)) | |
| (Rational(-1) ** bignum_value(3)).should eql(Rational(-1)) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment