Updated most tests to also do longs
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 2 Aug 2001 15:15:51 +0000 (15:15 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 2 Aug 2001 15:15:51 +0000 (15:15 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1121 4a8a32a2-be11-0410-ad9d-d568d2c75423

support/regression/failing/bug-435214.c [new file with mode: 0644]
support/regression/tests/args.c
support/regression/tests/bitwise.c
support/regression/tests/bug-227710.c
support/regression/tests/shifts.c
support/regression/tests/storage.c

diff --git a/support/regression/failing/bug-435214.c b/support/regression/failing/bug-435214.c
new file mode 100644 (file)
index 0000000..e19adf1
--- /dev/null
@@ -0,0 +1,17 @@
+/* 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);
+}
+
index 139fa2baac1bdd1c657b6d3c5d498373b34fac59..4c73c619e0faaaf9ed130ac43a7d41038d407d76 100644 (file)
@@ -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 <testfwk.h>
 
index c6dd0721caab849eadb9df221125271c63ef84b6..1ddc6f7ee05064c0bc2ee07c3e4d4fb470baab56 100644 (file)
@@ -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);
 }
-
index ccf98a5b6690d3af5df90bb39b664ba092d0c4cd..9b57e77ba4c0793753fbdfeed1bd985a4af4a619 100644 (file)
@@ -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;
index 2cab46ac6b3145fd7fdb96f4e57bbdc78b939192..23a594d051682901dbd6793093d2601c90137f24 100644 (file)
@@ -1,6 +1,7 @@
 /** 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);
@@ -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};
 
index b3e8a2048771fb3bd62b7a46bceee67423b57b1c..91142adfef72ac3c7262fa1cd443f0ce314e67f4 100644 (file)
@@ -2,7 +2,7 @@
 
     source_storage: static, register,
     dest_storage: static, register, 
-    type: char, int
+    type: char, int, long
  */
 #include <testfwk.h>