1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-02 03:04:31 +00:00
cc65/test/val/xor.c
2022-04-17 16:07:52 +02:00

65 lines
829 B
C

/*
!!DESCRIPTION!!
!!ORIGIN!! SDCC regression tests
!!LICENCE!! GPL, read COPYING.GPL
*/
#include <stdio.h>
#include <limits.h>
unsigned char success=0;
unsigned char failures=0;
unsigned char dummy=0;
unsigned char achar0 = 0;
unsigned char achar1 = 0;
unsigned char achar2 = 0;
void done()
{
dummy++;
}
void xor_chars_0_1(void)
{
achar2 = achar0 ^ achar1;
achar0 = achar0 ^ 0x1;
achar1 = achar0 ^ achar1 ^ 4;
}
void xor_if(void)
{
if(achar0 ^ achar1)
failures++;
achar0 ^= 0xff;
if( !(achar0 ^ achar1) )
failures++;
}
int main(void)
{
xor_chars_0_1();
if(achar2)
failures++;
if(achar0 != 1)
failures++;
if(achar1 != 5)
failures++;
achar0 = achar1;
xor_if();
success = failures;
done();
printf("failures: %d\n",failures);
return failures;
}