1 /*
2    20000715-1.c from the execute part of the gcc torture tests.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 void
test1(void)12 test1(void)
13 {
14   int x = 3, y = 2;
15 
16   if ((x < y ? x++ : y++) != 2)
17     ASSERT (0);
18 
19   if (x != 3)
20     ASSERT (0);
21 
22   if (y != 3)
23     ASSERT (0);
24 }
25 
26 void
test2(void)27 test2(void)
28 {
29   int x = 3, y = 2, z;
30 
31   z = (x < y) ? x++ : y++;
32   if (z != 2)
33     ASSERT (0);
34 
35   if (x != 3)
36     ASSERT (0);
37 
38   if (y != 3)
39     ASSERT (0);
40 }
41 
42 void
test3(void)43 test3(void)
44 {
45   int x = 3, y = 2;
46   int xx = 3, yy = 2;
47 
48   if ((xx < yy ? x++ : y++) != 2)
49     ASSERT (0);
50 
51   if (x != 3)
52     ASSERT (0);
53 
54   if (y != 3)
55     ASSERT (0);
56 }
57 
58 int x, y;
59 
60 static void
init_xy(void)61 init_xy(void)
62 {
63   x = 3;
64   y = 2;
65 }
66 
67 void
test4(void)68 test4(void)
69 {
70   init_xy();
71   if ((x < y ? x++ : y++) != 2)
72     ASSERT (0);
73 
74   if (x != 3)
75     ASSERT (0);
76 
77   if (y != 3)
78     ASSERT (0);
79 }
80 
81 void
test5(void)82 test5(void)
83 {
84   int z;
85 
86   init_xy();
87   z = (x < y) ? x++ : y++;
88   if (z != 2)
89     ASSERT (0);
90 
91   if (x != 3)
92     ASSERT (0);
93 
94   if (y != 3)
95     ASSERT (0);
96 }
97 
98 void
test6(void)99 test6(void)
100 {
101   int xx = 3, yy = 2;
102   int z;
103 
104   init_xy();
105   z = (xx < y) ? x++ : y++;
106   if (z != 2)
107     ASSERT (0);
108 
109   if (x != 3)
110     ASSERT (0);
111 
112   if (y != 3)
113     ASSERT (0);
114 }
115 
116 void
testTortureExecute(void)117 testTortureExecute (void){
118   test1 ();
119   test2 ();
120   test3 ();
121   test4 ();
122   test5 ();
123   test6 ();
124   return;
125 }
126 
127