Skip to content

Instantly share code, notes, and snippets.

@kronos
Created April 1, 2010 21:43
Show Gist options
  • Select an option

  • Save kronos/352402 to your computer and use it in GitHub Desktop.

Select an option

Save kronos/352402 to your computer and use it in GitHub Desktop.
diff --git a/spec/ruby/core/bignum/bit_xor_spec.rb b/spec/ruby/core/bignum/bit_xor_spec.rb
index 38a5850..26a38ea 100644
--- a/spec/ruby/core/bignum/bit_xor_spec.rb
+++ b/spec/ruby/core/bignum/bit_xor_spec.rb
@@ -11,6 +11,18 @@ describe "Bignum#^" do
(@bignum ^ 14).should == 9223372036854775836
end
+ it "returns self bitwise EXCLUSIVE OR negative other when one operand is negative" do
+ (@bignum ^ -0x40000000000000000).should == -64563604257983430638
+ (@bignum ^ -@bignum).should == -4
+ (@bignum ^ -0x8000000000000000).should == -18446744073709551598
+ end
+
+ it "returns self bitwise EXCLUSIVE OR negative other when both operands is negative" do
+ (-@bignum ^ -0x40000000000000000).should == 64563604257983430638
+ (-@bignum ^ -@bignum).should == 0
+ (-@bignum ^ -0x4000000000000000).should == 13835058055282163694
+ end
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment