struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / iso-8859-1.c
blob8b765aacae15dbca82a48848f134e6bb724574d6
1 /** tests for support for iso-8859-1. Extracted from string.c
2 */
3 #include <testfwk.h>
4 #include <string.h>
6 /* SDCC has limited support for source encodings other than utf-8. This is a small test for what is there. */
8 /** tests for multibyte character sets
9 * related to bug #3506236
11 #ifndef PORT_HOST
12 static void
13 do_multibyte (void)
15 const char *str = "ÔÂ";
17 ASSERT (str[0] == '\xd4');
18 ASSERT (str[1] == '\xc2');
21 // Test character constants - bug #2812.
22 void lcdWriteData (unsigned char LcdData)
24 const unsigned char output[] = {'a', 0xe1, 'u', 0xf5, 0};
26 static int i;
28 ASSERT (LcdData == output[i++]);
31 void lcdWriteText (char *pcText)
33 unsigned char i = 0;
35 while (pcText[i] != '\0') {
36 switch (pcText[i]) {
37 case 'ä' : lcdWriteData (0xE1);
38 break;
39 case 'ü' : lcdWriteData (0xF5);
40 break;
41 case 'ö' : lcdWriteData (0xEF);
42 break;
43 case 'ß' : lcdWriteData (0xE2);
44 break;
45 default : lcdWriteData (pcText[i]);
46 break;
48 i++;
51 #endif
53 void testStr (void)
55 #ifndef PORT_HOST
56 do_multibyte ();
57 #endif
60 void testCharconst (void)
62 #ifndef PORT_HOST
63 lcdWriteText ("aäuü");
64 #endif