struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / scott-compare.c
blobb3c5920726088a6bfc4bd9fc23e55857a9871268
1 /*
2 compare.c test compare
4 */
5 #include <testfwk.h>
7 unsigned char achar0 = 0;
8 unsigned char achar1 = 0;
9 unsigned int aint0 = 0;
10 unsigned int aint1 = 0;
12 char schar0 = 0;
13 char schar1 = 0;
15 /* achar0 should be zero */
17 void
18 compare_char_to_lits1 (void)
21 ASSERT (!(achar0));
23 ASSERT (!(achar0 == 1));
25 ASSERT (!(achar0 == 7));
27 ASSERT (!(achar0 != 0));
30 /* achar0 should be `5' */
31 void
32 compare_char_to_lits2 (void)
35 ASSERT (!(!achar0));
37 ASSERT (!(achar0 == 1));
39 ASSERT (!(achar0 == 7));
41 ASSERT (!(achar0 != 5));
45 /* achar0 should equal achar1 */
46 void
47 compare_char_to_char1 (void)
50 ASSERT (!(achar0 != achar1));
52 ASSERT (!(schar0 != schar1));
55 /* achar0 should be different than achar1 */
56 void
57 compare_char_to_char2 (void)
60 ASSERT (!(achar0 == achar1));
64 /* aint0 should be zero */
66 void
67 compare_int_to_lits1 (void)
70 ASSERT (!(aint0));
72 ASSERT (!(aint0 == 1));
74 ASSERT (!(aint0 == 7));
76 ASSERT (!(aint0 != 0));
79 /* aint0 should be `5' */
80 void
81 compare_int_to_lits2 (void)
84 ASSERT (!(!aint0));
86 ASSERT (!(aint0 == 1));
88 ASSERT (!(aint0 == 7));
90 ASSERT (!(aint0 != 5));
93 /* aint0 should be `0x1234' */
94 void
95 compare_int_to_lits3 (void)
98 ASSERT (!(!aint0));
100 ASSERT (!(aint0 == 1));
102 ASSERT (!(aint0 == 7));
104 ASSERT (!(aint0 != 0x1234));
107 /* aint0 should equal aint1 */
108 void
109 compare_int_to_int1 (void)
112 ASSERT (!(aint0 != aint1));
116 /* aint0 should be different than aint1 */
117 void
118 compare_int_to_int2 (void)
121 ASSERT (!(aint0 == aint1));
125 void
126 testCompare (void)
129 compare_char_to_lits1 ();
130 compare_char_to_char1 ();
131 achar0 = 5;
132 compare_char_to_lits2 ();
133 compare_char_to_char2 ();
136 compare_int_to_lits1 ();
137 aint0 = 5;
138 compare_int_to_lits2 ();
139 aint0 = 0x1234;
140 compare_int_to_lits3 ();
141 compare_int_to_int2 ();
142 aint0 = 0;
143 compare_int_to_int1 ();