struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug3183823.c
blob2774b9a87e3224f87b106edcb3ccafff5ce4215e
1 /*
2 bug3183823.c
3 */
5 #include <testfwk.h>
7 float neg (float x)
9 return -x;
12 void testNeg (void)
14 #if !defined(__SDCC_pic16) && !defined(__SDCC_pdk14) // Lack of memory
15 float x, y;
16 char a, b;
18 x = neg(0.0);
19 y = neg(-0.0);
20 ASSERT (x==0.0);
21 ASSERT (y==0.0);
22 ASSERT (x==-0.0);
23 ASSERT (y==-0.0);
24 ASSERT (x==y);
25 ASSERT (x>=y);
26 ASSERT (x<=y);
27 ASSERT (y>=x);
28 ASSERT (y<=x);
30 a = ((char*)&x)[0];
31 b = ((char*)&x)[3];
32 ((char*)&x)[0] = b;
33 ((char*)&x)[3] = a;
34 ASSERT (x!=0.0);
35 #endif