1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-10 10:04:50 +00:00
cc65/test/ref/charconst.c

61 lines
831 B
C
Raw Normal View History

2014-09-24 14:45:10 +00:00
/*
!!DESCRIPTION!! check if character constants are translated correctly
!!ORIGIN!! cc65 bug report
!!LICENCE!! Public Domain
*/
#include "common.h"
2014-09-24 14:45:10 +00:00
#include <limits.h>
#include <ctype.h>
void backslash(unsigned char c)
{
printf("%c : ",c);
switch (c)
{
case 'b':
c = '\b';
case 'f':
c = '\f';
case 'n':
c = '\n';
case 'r':
c = '\r';
case 't':
c = '\t';
case 'v':
#ifndef NO_BACKSLASH_V
c = '\v';
#else
c = 0x0b;
#endif
}
if(!isprint(c))
{
printf("ok.\n");
}
else
{
printf("failed.\n");
}
}
void testbackslash(void)
{
backslash('b');
backslash('f');
backslash('n');
backslash('r');
backslash('t');
backslash('v');
}
int main(void)
{
testbackslash();
return 0;
}