Debian Codegraph @

test cases/common/141 special characters/arg-unquoted-test.c

raw
1 #include <assert.h>
2 #include <stdio.h>
3 #include <string.h>
4
5 #define Q(x) #x
6 #define QUOTE(x) Q(x)
7
8 int main(int argc, char **argv) {
9 const char *s = QUOTE(CHAR);
10 assert(argc == 2);
11 assert(strlen(s) == 1);
12 if (s[0] != argv[1][0])
13 fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]);
14 assert(s[0] == argv[1][0]);
15 // There is no way to convert a macro argument into a character constant.
16 // Otherwise we'd test that as well
17 return 0;
18 }