[macruby-changes] [1450] MacRuby/branches/experimental/spec/frozen/core/fixnum/multiply_spec. rb
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 22 15:09:15 PDT 2009
Revision: 1450
http://trac.macosforge.org/projects/ruby/changeset/1450
Author: eloy.de.enige at gmail.com
Date: 2009-04-22 15:09:15 -0700 (Wed, 22 Apr 2009)
Log Message:
-----------
Fix Fixnum#* overflow spec to work correctly on both 32 and 64-bit impls.
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/fixnum/multiply_spec.rb
Modified: MacRuby/branches/experimental/spec/frozen/core/fixnum/multiply_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/fixnum/multiply_spec.rb 2009-04-22 22:09:05 UTC (rev 1449)
+++ MacRuby/branches/experimental/spec/frozen/core/fixnum/multiply_spec.rb 2009-04-22 22:09:15 UTC (rev 1450)
@@ -20,16 +20,18 @@
end
it "overflows to Bignum when the result does not fit in Fixnum" do
- # 32-bit fixnums
- y = 0x4000
- result = y * y * y
- result.should == 0x40000000000
- result.class.should == Bignum
-
- # 64-bit fixnums
- y = 0x40000000
- result = y * y * y
- result.should == 0x40000000000000000000000
- result.class.should == Bignum
+ if 1.size == 4
+ # 32-bit fixnums
+ y = 0x4000
+ result = y * y * y
+ result.should == 0x40000000000
+ result.class.should == Bignum
+ elsif 1.size == 8
+ # 64-bit fixnums
+ y = 0x40000000
+ result = y * y * y
+ result.should == 0x40000000000000000000000
+ result.class.should == Bignum
+ end
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090422/4fb9261f/attachment.html>
More information about the macruby-changes
mailing list