| 1 |
#define SHOULD_BE_UNDEFINED 1 |
| 2 |
|
| 3 |
#include"config3.h" |
| 4 |
#include<string.h> |
| 5 |
#include<stdio.h> |
| 6 |
|
| 7 |
#ifdef SHOULD_BE_UNDEFINED |
| 8 |
#error Token did not get undefined. |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifndef SHOULD_BE_DEFINED |
| 12 |
#error Token did not get defined |
| 13 |
#endif |
| 14 |
|
| 15 |
#define stringify(s) str(s) |
| 16 |
#define str(s) #s |
| 17 |
|
| 18 |
int main(void) { |
| 19 |
#if !(SHOULD_BE_UNQUOTED_STRING == string) |
| 20 |
printf("String token (unquoted) defined wrong.\n"); |
| 21 |
return 1; |
| 22 |
#endif |
| 23 |
if(strcmp(SHOULD_BE_STRING, "string") != 0) { |
| 24 |
printf("String token defined wrong.\n"); |
| 25 |
return 1; |
| 26 |
} |
| 27 |
if(strcmp(SHOULD_BE_STRING2, "A \"B\" C") != 0) { |
| 28 |
printf("String token 2 defined wrong.\n"); |
| 29 |
return 1; |
| 30 |
} |
| 31 |
if(strcmp(SHOULD_BE_STRING3, "A \"\" C") != 0) { |
| 32 |
printf("String token 3 defined wrong.\n"); |
| 33 |
return 1; |
| 34 |
} |
| 35 |
if(strcmp(SHOULD_BE_STRING4, "A \" C") != 0) { |
| 36 |
printf("String token 4 defined wrong.\n"); |
| 37 |
return 1; |
| 38 |
} |
| 39 |
if(SHOULD_BE_ONE != 1) { |
| 40 |
printf("One defined incorrectly.\n"); |
| 41 |
return 1; |
| 42 |
} |
| 43 |
if(SHOULD_BE_ZERO != 0) { |
| 44 |
printf("Zero defined incorrectly.\n"); |
| 45 |
return 1; |
| 46 |
} |
| 47 |
if(strcmp(SHOULD_BE_QUOTED_ONE, "1") != 0) { |
| 48 |
printf("Quoted number defined incorrectly.\n"); |
| 49 |
return 1; |
| 50 |
} |
| 51 |
SHOULD_BE_RETURN 0; |
| 52 |
} |