struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3478.c
blob5e5c03c4647b156bfc07068d7ad3724b37fdf9ac
1 /* bug-3478.c
2 A peephole optimizer issue destroyed a jump table.
3 */
5 #include <testfwk.h>
7 // Based on code by "Under4Mhz" licensed under GPL 2.0 or later
9 #include <string.h>
10 #include <stdio.h>
11 #include <stdint.h>
12 #include <stdbool.h>
14 typedef enum {
16 blockWoodLeft,
17 blockWood,
18 blockWoodRight,
19 blockWoodUnderLeft,
20 blockWoodOverLeft,
21 blockWoodUnderRight,
22 blockWoodOverRight,
23 blockEscalatorLeft,
24 blockEscalatorMoveLeft,
25 blockEscalatorMoveRight,
26 blockEscalatorRight,
27 blockJumpLeft,
28 blockJumpRight,
30 } Blocks;
32 bool IsFloor( uint8_t tile ) {
34 switch( tile ) {
36 case blockWood:
37 case blockWoodRight:
38 case blockWoodUnderLeft:
39 case blockWoodOverLeft:
40 case blockWoodUnderRight:
41 case blockWoodOverRight:
42 case blockEscalatorLeft:
43 case blockEscalatorMoveLeft:
44 case blockEscalatorMoveRight:
45 case blockEscalatorRight:
46 case blockJumpLeft:
47 case blockJumpRight:
48 return true;
51 return false;
54 void
55 testBug(void) {
56 ASSERT( IsFloor(blockJumpRight) == true );
57 ASSERT( IsFloor(blockJumpLeft) == true );