--- /dev/null
+/* bug-435214.c
+ */
+#include <testfwk.h>
+
+static
+unsigned int divide(long a)
+{
+ return a/512ul;
+}
+
+static void
+testDivide()
+{
+ assert(divide(1300) == 2);
+ assert(divide(0x12345678) == 0x91A2B);
+}
+
/** Tests argument passing to functions.
Assumes that up to the first two arguments can be passed in registers.
- type1: char, int
- type2: char, int
- type3: char, int
+ type1: char, int, long
+ type2: char, int, long
+ type3: char, int, long
*/
#include <testfwk.h>
/** Test the bitwise operators.
- type: char, int
+ type: char, int, long
attr: volatile,
storage: static,
*/
ASSERT(({type})(left ^ 0xc1ec) == ({type})0xFC1B);
ASSERT(({type})(0x3df7 ^ right) == ({type})0xFC1B);
}
-
unsigned char index;
} s;
-static unsigned char
+unsigned char
foo(void)
{
// BUG, there will be a PRE-increment
return p[s.index++];
}
-static void
+void
testPostIncrement(void)
{
p = _data;
/** Tests covering the shift operators.
- type: char, int
+ sign: signed, unsigned
+ type: char, int, long
storage: static,
attr: volatile
*/
#include <testfwk.h>
-static void
+void
testShiftClasses(void)
{
- {attr} {storage} {type} i, result;
+ {attr} {storage} {sign} {type} i, result;
i = 30;
ASSERT(i>>3 == 3);
ASSERT(result == 120);
}
+void
+testShiftRight(void)
+{
+ {attr} {storage} {type} i, result;
+
+ i = -120;
+ ASSERT(i>>2 == -30);
+
+ result = i;
+ result >>= 3;
+ ASSERT(result == -15);
+}
+
/** PENDING: Disabled. */
static void
testShiftByteMultiples(void)
{
#if 0
+ /* PENDING */
{attr} {storage} {type} i;
i = ({type}){vals};
static void
testShiftOne(void)
{
- {attr} {storage} {type} i;
- {type} result;
+ {attr} {storage} {sign} {type} i;
+ {sign} {type} result;
i = ({type}){vals};
source_storage: static, register,
dest_storage: static, register,
- type: char, int
+ type: char, int, long
*/
#include <testfwk.h>