From: michaelh Date: Thu, 2 Aug 2001 15:15:51 +0000 (+0000) Subject: Updated most tests to also do longs X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=310379d67c0559f33b1f2da2de2080c4d72ed553;p=fw%2Fsdcc Updated most tests to also do longs git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1121 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/support/regression/failing/bug-435214.c b/support/regression/failing/bug-435214.c new file mode 100644 index 00000000..e19adf11 --- /dev/null +++ b/support/regression/failing/bug-435214.c @@ -0,0 +1,17 @@ +/* bug-435214.c + */ +#include + +static +unsigned int divide(long a) +{ + return a/512ul; +} + +static void +testDivide() +{ + assert(divide(1300) == 2); + assert(divide(0x12345678) == 0x91A2B); +} + diff --git a/support/regression/tests/args.c b/support/regression/tests/args.c index 139fa2ba..4c73c619 100644 --- a/support/regression/tests/args.c +++ b/support/regression/tests/args.c @@ -1,9 +1,9 @@ /** 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 diff --git a/support/regression/tests/bitwise.c b/support/regression/tests/bitwise.c index c6dd0721..1ddc6f7e 100644 --- a/support/regression/tests/bitwise.c +++ b/support/regression/tests/bitwise.c @@ -1,6 +1,6 @@ /** Test the bitwise operators. - type: char, int + type: char, int, long attr: volatile, storage: static, */ @@ -29,4 +29,3 @@ testTwoOpBitwise(void) ASSERT(({type})(left ^ 0xc1ec) == ({type})0xFC1B); ASSERT(({type})(0x3df7 ^ right) == ({type})0xFC1B); } - diff --git a/support/regression/tests/bug-227710.c b/support/regression/tests/bug-227710.c index ccf98a5b..9b57e77b 100644 --- a/support/regression/tests/bug-227710.c +++ b/support/regression/tests/bug-227710.c @@ -12,14 +12,14 @@ struct { 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; diff --git a/support/regression/tests/shifts.c b/support/regression/tests/shifts.c index 2cab46ac..23a594d0 100644 --- a/support/regression/tests/shifts.c +++ b/support/regression/tests/shifts.c @@ -1,6 +1,7 @@ /** Tests covering the shift operators. - type: char, int + sign: signed, unsigned + type: char, int, long storage: static, attr: volatile @@ -10,10 +11,10 @@ */ #include -static void +void testShiftClasses(void) { - {attr} {storage} {type} i, result; + {attr} {storage} {sign} {type} i, result; i = 30; ASSERT(i>>3 == 3); @@ -28,11 +29,25 @@ testShiftClasses(void) 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}; @@ -50,8 +65,8 @@ testShiftByteMultiples(void) static void testShiftOne(void) { - {attr} {storage} {type} i; - {type} result; + {attr} {storage} {sign} {type} i; + {sign} {type} result; i = ({type}){vals}; diff --git a/support/regression/tests/storage.c b/support/regression/tests/storage.c index b3e8a204..91142adf 100644 --- a/support/regression/tests/storage.c +++ b/support/regression/tests/storage.c @@ -2,7 +2,7 @@ source_storage: static, register, dest_storage: static, register, - type: char, int + type: char, int, long */ #include