projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated most tests to also do longs
[fw/sdcc]
/
support
/
regression
/
tests
/
shifts.c
diff --git
a/support/regression/tests/shifts.c
b/support/regression/tests/shifts.c
index 2cab46ac6b3145fd7fdb96f4e57bbdc78b939192..23a594d051682901dbd6793093d2601c90137f24 100644
(file)
--- a/
support/regression/tests/shifts.c
+++ b/
support/regression/tests/shifts.c
@@
-1,6
+1,7
@@
/** Tests covering the shift operators.
/** Tests covering the shift operators.
- type: char, int
+ sign: signed, unsigned
+ type: char, int, long
storage: static,
attr: volatile
storage: static,
attr: volatile
@@
-10,10
+11,10
@@
*/
#include <testfwk.h>
*/
#include <testfwk.h>
-
static
void
+void
testShiftClasses(void)
{
testShiftClasses(void)
{
- {attr} {storage} {type} i, result;
+ {attr} {storage} {
sign} {
type} i, result;
i = 30;
ASSERT(i>>3 == 3);
i = 30;
ASSERT(i>>3 == 3);
@@
-28,11
+29,25
@@
testShiftClasses(void)
ASSERT(result == 120);
}
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: Disabled. */
static void
testShiftByteMultiples(void)
{
#if 0
+ /* PENDING */
{attr} {storage} {type} i;
i = ({type}){vals};
{attr} {storage} {type} i;
i = ({type}){vals};
@@
-50,8
+65,8
@@
testShiftByteMultiples(void)
static void
testShiftOne(void)
{
static void
testShiftOne(void)
{
- {attr} {storage} {type} i;
- {type} result;
+ {attr} {storage} {
sign} {
type} i;
+ {
sign} {
type} result;
i = ({type}){vals};
i = ({type}){vals};