]> git.sur5r.net Git - cc65/blob - test/ref/charconst.c
1aa9f8e3f6bae26ed7e9d9ea0dd4cd30b030288e
[cc65] / test / ref / charconst.c
1 /*
2   !!DESCRIPTION!! check if character constants are translated correctly
3   !!ORIGIN!!      cc65 bug report
4   !!LICENCE!!     Public Domain
5 */
6
7 #include <limits.h>
8 #include <ctype.h>
9
10 void backslash(unsigned char c)
11 {
12     printf("%c : ",c);
13
14     switch (c)
15     {
16         case 'b':
17                 c = '\b';
18         case 'f':
19                 c = '\f';
20         case 'n':
21                 c = '\n';
22         case 'r':
23                 c = '\r';
24         case 't':
25                 c = '\t';
26         case 'v':
27     #ifndef NO_BACKSLASH_V
28         c = '\v';
29     #else
30         c = 0x0b;
31     #endif
32         }
33
34     if(!isprint(c))
35     {
36         printf("ok.\n");
37     }
38     else
39     {
40         printf("failed.\n");
41     }
42 }
43
44 void testbackslash(void)
45 {
46         backslash('b');
47         backslash('f');
48         backslash('n');
49         backslash('r');
50         backslash('t');
51         backslash('v');
52 }
53
54 int main(void)
55 {
56         testbackslash();
57
58         return 0;
59 }