struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-950607-2.c
blob9deb0a0089040297a7f4ee4217d72dc7ce7c72ec
1 /*
2 950607-2.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 typedef struct {
12 long int p_x, p_y;
13 } Point;
15 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) &&!defined(__SDCC_pdk15) // Lack of memory
16 int
17 f (Point basePt, Point pt1, Point pt2)
19 long long vector;
21 vector =
22 (long long) (pt1.p_x - basePt.p_x) * (long long) (pt2.p_y - basePt.p_y) -
23 (long long) (pt1.p_y - basePt.p_y) * (long long) (pt2.p_x - basePt.p_x);
25 if (vector > (long long) 0)
26 return 0;
27 else if (vector < (long long) 0)
28 return 1;
29 else
30 return 2;
32 #endif
34 void
35 testTortureExecute (void)
37 #if !(defined(__SDCC_mcs51) && defined(__SDCC_MODEL_SMALL)) && !defined(__SDCC_pdk14) &&!defined(__SDCC_pdk15) // Lack of memory
38 Point b, p1, p2;
39 int answer;
41 b.p_x = -23250;
42 b.p_y = 23250;
44 p1.p_x = 23250;
45 p1.p_y = -23250;
47 p2.p_x = -23250;
48 p2.p_y = -23250;
50 answer = f (b, p1, p2);
52 if (answer != 1)
53 ASSERT (0);
54 return;
55 #endif