struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug1738367.c
blobe0fcb0f1a668fc5e1ed59ad1c85c546246ddcc37
1 /*
2 bug1738367.c
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_sdcc99
9 #endif
11 #include <stdbool.h>
13 #ifdef __bool_true_false_are_defined
15 bool ternary(unsigned char status)
17 return (status == 0) ? 0 : 1;
20 bool ternary_inv(unsigned char status)
22 return (status == 0) ? 1 : 0;
26 bool ternary1(unsigned char status)
28 return status ? 1 : 0;
31 bool ternary1_inv(unsigned char status)
33 return status ? 0 : 1;
37 bool ternary2(unsigned char status)
39 return !status ? 0 : 1;
42 bool ternary2_inv(unsigned char status)
44 return !status ? 1 : 0;
47 #endif //__bool_true_false_are_defined
50 void
51 testBug(void)
53 #ifndef __SDCC_pic16
54 #ifdef __bool_true_false_are_defined
55 ASSERT(!ternary(0x00));
56 ASSERT( ternary(0x10));
58 ASSERT( ternary_inv(0x00));
59 ASSERT(!ternary_inv(0x10));
61 ASSERT(!ternary1(0x00));
62 ASSERT( ternary1(0x10));
64 ASSERT( ternary1_inv(0x00));
65 ASSERT(!ternary1_inv(0x10));
67 ASSERT(!ternary2(0x00));
68 ASSERT( ternary2(0x10));
70 ASSERT( ternary2_inv(0x00));
71 ASSERT(!ternary2_inv(0x10));
72 ASSERT(!ternary2_inv(1==1));
73 #endif //__bool_true_false_are_defined
74 #endif