struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-compare-1.c
blob9321923b851725bc2321041b6ff1226ca00f8129
1 /*
2 compare-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* Copyright (C) 2002 Free Software Foundation.
13 Test for correctness of composite comparisons.
15 Written by Roger Sayle, 3rd June 2002. */
17 int ieq (int x, int y, int ok)
19 if ((x<=y) && (x>=y))
21 if (!ok) ASSERT (0);
23 else
24 if (ok) ASSERT (0);
26 if ((x<=y) && (x==y))
28 if (!ok) ASSERT (0);
30 else
31 if (ok) ASSERT (0);
33 if ((x<=y) && (y<=x))
35 if (!ok) ASSERT (0);
37 else
38 if (ok) ASSERT (0);
40 if ((y==x) && (x<=y))
42 if (!ok) ASSERT (0);
44 else
45 if (ok) ASSERT (0);
48 int ine (int x, int y, int ok)
50 if ((x<y) || (x>y))
52 if (!ok) ASSERT (0);
54 else
55 if (ok) ASSERT (0);
58 int ilt (int x, int y, int ok)
60 if ((x<y) && (x!=y))
62 if (!ok) ASSERT (0);
64 else
65 if (ok) ASSERT (0);
68 int ile (int x, int y, int ok)
70 if ((x<y) || (x==y))
72 if (!ok) ASSERT (0);
74 else
75 if (ok) ASSERT (0);
78 int igt (int x, int y, int ok)
80 if ((x>y) && (x!=y))
82 if (!ok) ASSERT (0);
84 else
85 if (ok) ASSERT (0);
88 int ige (int x, int y, int ok)
90 if ((x>y) || (x==y))
92 if (!ok) ASSERT (0);
94 else
95 if (ok) ASSERT (0);
98 void
99 testTortureExecute (void)
101 ieq (1, 4, 0);
102 ieq (3, 3, 1);
103 ieq (5, 2, 0);
105 ine (1, 4, 1);
106 ine (3, 3, 0);
107 ine (5, 2, 1);
109 ilt (1, 4, 1);
110 ilt (3, 3, 0);
111 ilt (5, 2, 0);
113 ile (1, 4, 1);
114 ile (3, 3, 1);
115 ile (5, 2, 0);
117 igt (1, 4, 0);
118 igt (3, 3, 0);
119 igt (5, 2, 1);
121 ige (1, 4, 0);
122 ige (3, 3, 1);
123 ige (5, 2, 1);
125 return;