Regression test for #1596270, #1736867
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Feb 2008 12:59:53 +0000 (12:59 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Feb 2008 12:59:53 +0000 (12:59 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5034 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
support/regression/tests/bugs-1596270-1736867.c [new file with mode: 0644]

index 49458173b4d35e85aea3394d090e1bce7574ad42..13ae03e6482c8b302490114fbcba85fe831ff827 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
+
+       * support/regression/tests/bugs-1596270-1736867.c: Regression test for #1596270, #1736867
+
 2008-02-20 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/SDCClrange.c (findPrevUse): fixed bug 1888147
diff --git a/support/regression/tests/bugs-1596270-1736867.c b/support/regression/tests/bugs-1596270-1736867.c
new file mode 100644 (file)
index 0000000..bbaac76
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+        bugs 1596270 and 1736867.
+*/
+
+#include <testfwk.h>
+
+
+typedef unsigned char UINT8;
+typedef unsigned char S_GAMES_SI_CHARS;
+
+typedef struct
+{
+  S_GAMES_SI_CHARS c;
+  UINT8 x, y;
+}S_GAMES_SI_BLOCK_STRUCT;
+#define S_GAMES_SI_BLOCK_STRUCT_size sizeof(S_GAMES_SI_BLOCK_STRUCT)
+
+
+static void
+s_Games_SI_BlockInit(S_GAMES_SI_BLOCK_STRUCT *bl, UINT8
+i, UINT8 x, UINT8 y)
+{
+  bl[i ].x = x - 1; bl[i ].y = y - 1;
+  bl[i + 1].x = x ; bl[i + 1].y = y - 1;
+  bl[i + 2].x = x + 1;
+  bl[i + 2].y = y - 1;
+  bl[i + 3].x = x - 1; bl[i + 3].y = y ;
+  bl[i + 4].x = x ; bl[i + 4].y = y ;
+  bl[i + 5].x = x + 1; bl[i + 5].y = y ;
+  bl[i + 6].x = x - 1; bl[i + 6].y = y + 1;
+  bl[i + 7].x = x ; bl[i + 7].y = y + 1;
+  bl[i + 8].x = x + 1; bl[i + 8].y = y + 1;
+}
+
+void
+testBug156270(void)
+{
+  S_GAMES_SI_BLOCK_STRUCT b[9];
+  s_Games_SI_BlockInit(b, 0, 1, 1);
+  ASSERT(b[1].x == 1); /* 1596270 */
+  ASSERT(b[1].y == 0); /* 1596270 */
+  ASSERT(b[2].x == 2); /* 1596270 */
+  ASSERT(b[2].y == 0); /* 1736867 */
+}
+