* src/SDCCglue.c (printIvalBitFields): fixed bug 1806631
[fw/sdcc] / support / regression / tests / shifts.c
index 80c8768f68367119ff0842d2dae7cd97c5f855a9..0eb607f91a808f4cf007377efca0e50fc71baf35 100644 (file)
@@ -1,4 +1,5 @@
 /** Tests covering the shift operators.
+    disabled for pic16
 
     sign: signed, unsigned
     type: char, int, long
@@ -12,7 +13,7 @@
 #include <testfwk.h>
 
 void
-testShiftClasses(void)
+test1ShiftClasses(void)
 {
     {attr} {storage} {sign} {type} i, result;
 
@@ -30,7 +31,7 @@ testShiftClasses(void)
 }
 
 void
-testShiftRight(void)
+test2ShiftRight(void)
 {
     {attr} {storage} {type} i, result;
 
@@ -48,8 +49,8 @@ testShiftRight(void)
     ASSERT(result == -15); 
 }
 
-static void
-testShiftByteMultiples(void)
+void
+test3ShiftByteMultiples(void)
 {
     {attr} {storage} {type} i;
 
@@ -64,8 +65,8 @@ testShiftByteMultiples(void)
     ASSERT((({type}) i<<24) == (({type}) {vals} << 24));
 }
 
-static void
-testShiftOne(void)
+void
+test4ShiftOne(void)
 {
     {attr} {storage} {sign} {type} i;
     {sign} {type} result;
@@ -86,3 +87,24 @@ testShiftOne(void)
     result <<= 1;
     ASSERT(result == ({type})(({type}){vals} << 1));
 }
+
+static {type} ShiftLeftByParam ({type} count)
+{
+    {attr} {storage} {type} i;
+    i = ({type}){vals};
+    return (i << count);
+}
+
+static {type} ShiftRightByParam ({type} count)
+{
+    {attr} {storage} {type} i;
+    i = ({type}){vals};
+    return (i >> count);
+}
+
+void
+testShiftByParam(void)
+{
+    ASSERT(ShiftLeftByParam(2)  == ({type})({vals} << 2));
+    ASSERT(ShiftRightByParam(2) == ({type})({vals} >> 2));
+}