blob: 349347ee3b01f2c42dd0b79491639a858ee0cda9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
int
libfonts_parse_order__(enum libfonts_subpixel_order *outp, const char *value)
{
#define X(C, S)\
if (!strcasecmp(value, S)) {\
*outp = C;\
} else
LIST_SUBPIXEL_ORDERS(X,) {
*outp = LIBFONTS_SUBPIXEL_ORDER_OTHER;
return 0;
}
#undef X
return 1;
}
#else
int
main(void)
{
enum libfonts_subpixel_order res;
char buf[1024];
size_t i;
#define X(C, S)\
do {\
res = 999;\
ASSERT(libfonts_parse_order__(&res, S) == 1);\
ASSERT(res == C);\
strcpy(buf, S);\
for (i = 0; buf[i]; i++)\
buf[i] = toupper(buf[i]);\
res = 999;\
ASSERT(libfonts_parse_order__(&res, buf) == 1);\
ASSERT(res == C);\
} while (0)
LIST_SUBPIXEL_ORDERS(X, ;);
#undef X
res = 999;
ASSERT(libfonts_parse_order__(&res, " something else ") == 0);
ASSERT(res == LIBFONTS_SUBPIXEL_ORDER_OTHER);
return 0;
}
#endif
|