struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-switch-1.c
blob43b30f299e59bf982fca82343b51c7cfd580f939
1 /*
2 switch-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) 2003 Free Software Foundation.
13 Test that switch statements suitable using case bit tests are
14 implemented correctly.
16 Written by Roger Sayle, 01/25/2001. */
18 int
19 foo (int x)
21 switch (x)
23 case 4:
24 case 6:
25 case 9:
26 case 11:
27 return 30;
29 return 31;
32 void
33 testTortureExecute (void)
35 int i, r;
37 for (i=-1; i<66; i++)
39 r = foo (i);
40 if (i == 4)
42 if (r != 30)
43 ASSERT (0);
45 else if (i == 6)
47 if (r != 30)
48 ASSERT (0);
50 else if (i == 9)
52 if (r != 30)
53 ASSERT (0);
55 else if (i == 11)
57 if (r != 30)
58 ASSERT (0);
60 else if (r != 31)
61 ASSERT (0);
63 return;