Permalink
Browse files

Added rbx specific Fixnum#<<, #>> specs.

  • Loading branch information...
1 parent 9fc80b0 commit b2acbcd0be271f1f04911c8aea65094c6c3e544a Brian Ford committed May 19, 2010
Showing with 38 additions and 0 deletions.
  1. +19 −0 spec/core/fixnum/left_shift_spec.rb
  2. +19 −0 spec/core/fixnum/right_shift_spec.rb
@@ -0,0 +1,19 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "Fixnum#<< with n << m" do
+ it "raises a RangeError when m > 0 and the Integer argument is not in Fixnum range" do
+ lambda { 3 << (fixnum_max() + 1) }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m > 0 the Float argument is not in Fixnum range" do
+ lambda { 3 << (fixnum_max() + 1).to_f }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m < 0 and the Integer argument is not in Fixnum range" do
+ lambda { 3 << -(fixnum_max() + 1) }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m < 0 the Float argument is not in Fixnum range" do
+ lambda { 3 << -(fixnum_max() + 1).to_f }.should raise_error(RangeError)
+ end
+end
@@ -0,0 +1,19 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "Fixnum#>> with n >> m" do
+ it "raises a RangeError when m > 0 and the Integer argument is not in Fixnum range" do
+ lambda { 3 >> (fixnum_max() + 1) }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m > 0 the Float argument is not in Fixnum range" do
+ lambda { 3 >> (fixnum_max() + 1).to_f }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m < 0 and the Integer argument is not in Fixnum range" do
+ lambda { 3 >> -(fixnum_max() + 1) }.should raise_error(RangeError)
+ end
+
+ it "raises a RangeError when m < 0 the Float argument is not in Fixnum range" do
+ lambda { 3 >> -(fixnum_max() + 1).to_f }.should raise_error(RangeError)
+ end
+end

0 comments on commit b2acbcd

Please sign in to comment.