Skip to content
Permalink
Browse files

More passing specs for bignums.

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 7, 2013
1 parent 4a6b5b5 commit 5d4204ca0e031d351c02a2a673d59431ceff4e42
@@ -1,4 +1 @@
fails:raises a TypeError when passed a Float
fails:calls #to_int to convert an object to an Integer
fails:raises a TypeError if #to_int does not return an Integer
fails:raises a TypeError if the object does not respond to #to_int
@@ -1,7 +1 @@
fails:Bignum#| returns self bitwise OR other
fails:Bignum#| returns self bitwise OR other when one operand is negative
fails:Bignum#| returns self bitwise OR other when both operands are negative
fails:Bignum#| raises a TypeError when passed a Float
fails:Bignum#| calls #to_int to convert an object to an Integer
fails:Bignum#| raises a TypeError if #to_int does not return an Integer
fails:Bignum#| raises a TypeError if the object does not respond to #to_int
@@ -1,4 +1 @@
fails:raises a TypeError when passed a Float
fails:calls #to_int to convert an object to an Integer
fails:raises a TypeError if #to_int does not return an Integer
fails:raises a TypeError if the object does not respond to #to_int
@@ -1,3 +1,2 @@
fails:Bignum#== returns true if self has the same value as the given argument
fails:Bignum#== calls 'other == self' if the given argument is not an Integer
fails:Bignum#== returns the result of 'other == self' as a boolean
@@ -28,7 +28,7 @@ def int(space, w_obj):

@staticmethod
def bigint(space, w_obj):
return space.bigint_w(w_obj)
return space.bigint_w(space.convert_type(w_obj, space.w_integer, "to_int"))

@staticmethod
def float(space, w_obj):
@@ -83,6 +83,10 @@ def method_left_shift(self, space, other):
def method_and(self, space, other):
return space.newbigint_fromrbigint(self.bigint.and_(other))

@classdef.method("|", other="bigint")
def method_or(self, space, other):
return space.newbigint_fromrbigint(self.bigint.or_(other))

@classdef.method("^", other="bigint")
def method_xor(self, space, other):
return space.newbigint_fromrbigint(self.bigint.xor(other))

0 comments on commit 5d4204c

Please sign in to comment.
You can’t perform that action at this time.