1 /** Test the comparison operators.
10 testCmpAroundZero(void)
12 {attr
} {storage
} signed {type
} i
;
20 #if !defined(__SDCC_pdk14) // Lack of memory
21 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
37 testCompareConstants(void)
39 {attr
} {storage
} signed {type
} i
;
45 #if !defined(__SDCC_pdk14) // Lack of memory
46 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
59 #if !defined(__SDCC_pdk14) // Lack of memory
60 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
73 testCompareVariables(void)
75 {attr
} {storage
} signed {type
} left
, right
;
80 ASSERT(left
<= right
);
82 ASSERT(right
>= left
);
86 ASSERT(left
>= right
);
88 ASSERT(right
<= left
);
89 #if !defined(__SDCC_pdk14) // Lack of memory
90 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
93 ASSERT(left
>= right
);
95 ASSERT(right
<= left
);
98 ASSERT(left
== right
);
99 ASSERT(left
<= right
);
100 ASSERT(left
>= right
);
106 testUnsignedCompare(void)
108 {attr
} {storage
} unsigned {type
} left
, right
;
111 right
= (unsigned {type
})-1;
113 ASSERT(left
< right
);
114 ASSERT(left
<= right
);
115 ASSERT(right
> left
);
116 ASSERT(right
>= left
);
122 #if !defined(__SDCC_pdk14) // Lack of memory
133 /* Test optimization for eliminating redundant loads in range tests. s and u should not be volatile. */
136 #if !defined(__SDCC_pdk14) // Lack of memory
137 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
140 ASSERT (s
>= 17 && s
<= 20);
141 ASSERT (u
>= 17 && u
<= 20);
145 ASSERT (!(s
>= 17 && s
<= 20));
146 ASSERT (!(u
>= 17 && u
<= 20));
150 ASSERT (s
> 17 && s
< 20);
151 ASSERT (u
> 17 && u
< 20);
155 ASSERT (!(s
> 17 && s
< 20));
156 ASSERT (!(u
> 17 && u
< 20));
161 void testPointerCompare(void)
164 fptr
= &testPointerCompare
;
167 ASSERT(fptr
== &testPointerCompare
);
175 Constants on either side (reversal)