mirror of
https://github.com/cc65/cc65.git
synced 2025-02-05 04:37:23 +00:00
test related to pr #1425
This commit is contained in:
parent
7d528d9eb0
commit
57e69d9647
45
test/val/pr1425.c
Normal file
45
test/val/pr1425.c
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
/* pr #1425 - Ternary fixes */
|
||||||
|
|
||||||
|
unsigned char fails = 0;
|
||||||
|
|
||||||
|
void test1(void)
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
x ? (void)x-- : (void)1;
|
||||||
|
if (x != 0) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int test2(void)
|
||||||
|
{
|
||||||
|
int x = 0, y = 0;
|
||||||
|
x ? (void)x--, (void)y++ : (void)1;
|
||||||
|
if (x != 0) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
if (y != 0) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test3(void)
|
||||||
|
{
|
||||||
|
int x = 0, y = 0;
|
||||||
|
x ? ((void)x--, (void)y++) : (void)1;
|
||||||
|
if (x != 0) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
if (y != 0) {
|
||||||
|
fails++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
test1();
|
||||||
|
test2();
|
||||||
|
test3();
|
||||||
|
return fails;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user