Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit b2acbcd0be271f1f04911c8aea65094c6c3e544a 1 parent 9fc80b0
@brixen brixen authored
View
19 spec/core/fixnum/left_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
View
19 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
Please sign in to comment.
Something went wrong with that request. Please try again.