1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

Made a regression test increment a variable after, instead of before, using it.

That change allows the initial value of zero to be tested.
This commit is contained in:
Greg King 2020-07-20 17:16:11 -04:00
parent 5a9d76ad52
commit 517df130cc

View File

@ -7,34 +7,31 @@
unsigned char x = 0;
unsigned char PrintVar1(void)
static unsigned char PrintVar1(void)
{
unsigned char cx = x + 1;
printf("cx:%d x:%d\n", cx, x);
return cx == 0;
}
unsigned char PrintVar2(void)
static unsigned char PrintVar2(void)
{
unsigned char cx = x + 1;
unsigned char cy;
cy = x + 1;
printf("cx:%d cy:%d x:%d\n", cx, cy, x);
return cx != cy;
}
#pragma static-locals (off)
unsigned char n;
unsigned char ret = 0;
static unsigned char ret = 0;
int main(void)
{
for (n = 0; n < 10; n++) {
++x;
do {
ret |= PrintVar1();
ret |= PrintVar2();
}
} while (++x < 10);
return ret;
}