]> git.sur5r.net Git - cc65/blob - test/ref/cc65110211.c
Removed a "cc65_" prefix.
[cc65] / test / ref / cc65110211.c
1 /*
2   !!DESCRIPTION!! unreachable code related bug
3   !!ORIGIN!!      Testsuite
4   !!LICENCE!!     Public Domain
5 */
6
7 /*
8     test2 and test3 will result in an endless loop (SVN version: 4974M)
9 */
10
11 #include <stdio.h>
12
13 #define OPENTEST()
14 #define CLOSETEST()
15
16 static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
17
18 int test1(void)
19 {
20     int res;
21     unsigned char *p;
22
23     p = upper;
24     res = 0;
25
26     while(*p) {
27         if(*p < 0) {
28             res = 1;
29         }
30         p++;
31     }
32
33     printf("test1:ok\n");
34     return res;
35 }
36
37 int test2(void)
38 {
39     int res;
40     unsigned char *p;
41
42     p = upper;
43     res = 0;
44
45     while(*p) {
46         if(*p++ < 0) {
47             res = 1;
48         }
49     }
50
51     printf("test2:ok\n");
52     return res;
53 }
54
55 int test3(void)
56 {
57     int res;
58     unsigned char *p;
59
60     p = upper;
61     res = 0;
62
63     while(*p) {
64         if(*++p < 0) {
65             res = 1;
66         }
67     }
68
69     printf("test3:ok\n");
70     return res;
71 }
72
73 int main(int n,char **args)
74 {
75     test1();
76     test2();
77     test3();
78
79     printf("it works :)\n");
80
81     return 0;
82 }