RegressionTests__IntegerTest.st
changeset 107 cb302e2b079c
parent 104 baa58c703a71
child 112 e3bd6adcc7cf
--- a/RegressionTests__IntegerTest.st	Thu May 24 00:36:46 2001 +0200
+++ b/RegressionTests__IntegerTest.st	Thu May 24 18:14:38 2001 +0200
@@ -1064,6 +1064,49 @@
     "
 !
 
+testIntegerShifts4
+    "arithmetic tests.
+     Notice, the arithmetic tests are both performed via regular sends
+     and via constructed performs. The reason is to test both inlined
+     JIT-compiler code AND the regular methods code."
+
+    |a|
+
+    a := 16r1234.
+
+    self assert:( ((a bitShift:-4) bitAnd:16rFF) == 16r23 ).
+    self assert:( ((a bitShift:-8) bitAnd:16rFF) == 16r12 ).
+    self assert:( ((a bitShift:-12) bitAnd:16rFF) == 16r1 ).
+    self assert:( ((a bitShift:-16) bitAnd:16rFF) == 0 ).
+
+    "/ should not shift in any sign bits ...
+    a := 16r1FFFFFFF.
+    self assert:( (a bitShift:-4) == 16r1FFFFFF ).
+    a := 16r3FFFFFFF.
+    self assert:( (a bitShift:-4) == 16r3FFFFFF ).
+    a := 16r7FFFFFFF.
+    self assert:( (a bitShift:-4) == 16r7FFFFFF ).
+    a := 16rFFFFFFFF.
+    self assert:( (a bitShift:-4) == 16rFFFFFFF ).
+    a := 16r1FFFFFFFF.
+    self assert:( (a bitShift:-4) == 16r1FFFFFFF ).
+
+    a := 16r1FFFFFFF.
+    self assert:( (a bitShift:-8) == 16r1FFFFF ).
+    a := 16r3FFFFFFF.
+    self assert:( (a bitShift:-8) == 16r3FFFFF ).
+    a := 16r7FFFFFFF.
+    self assert:( (a bitShift:-8) == 16r7FFFFF ).
+    a := 16rFFFFFFFF.
+    self assert:( (a bitShift:-8) == 16rFFFFFF ).
+    a := 16r1FFFFFFFF.
+    self assert:( (a bitShift:-8) == 16r1FFFFFF ).
+
+    "
+     self basicNew testIntegerShifts4
+    "
+!
+
 testLargeAddition
     "general conversion & arithmetic tests.
      Notice, the arithmetic tests are both performed via regular sends