]> git.gag.com Git - fw/sdcc/blobdiff - support/regression/tests/zeropad.c
* as/mcs51/lkarea.c: removed old K&R style,
[fw/sdcc] / support / regression / tests / zeropad.c
index f791859d106c7d56ce64ff639cef397779f35584..f8f759da7456aa1cd0ef7545c11beaebf78d82d1 100644 (file)
@@ -1,6 +1,6 @@
 /** Zeropad tests.
 
-    storage: idata, xdata, code,
+    storage: idata, pdata, xdata, code,
 */
 #ifndef STORAGE
 #define STORAGE {storage}
@@ -22,10 +22,26 @@ typedef unsigned int size_t;
 
 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
 # define idata
+# define pdata
 # define xdata
 # define code
 #endif
 
+#if defined(SDCC_hc08)
+# define idata data
+# define pdata data
+#endif
+
+const char *string1 = "\x00\x01";
+const char string2[] = "\x00\x01";
+
+#ifndef PORT_HOST
+#pragma disable_warning 147 //no warning about excess initializers (W_EXCESS_INITIALIZERS)
+//array will be truncated but warning will be suppressed
+//if truncation is incorrect, other ASSERTs will fail with high probability
+char STORAGE trunc[2] = {'a', 'b', 'c'};
+#endif
+
 char STORAGE array[5] = {'a', 'b', 'c'};
 
 #if TEST_G
@@ -64,6 +80,9 @@ struct y STORAGE incompletestruct = {
 void
 testZeropad(void)
 {
+  ASSERT(string1[1] == '\x01');
+  ASSERT(string2[1] == '\x01');
+
   ASSERT(array[2] == 'c');
   ASSERT(array[4] == 0);