4 static int test_decode_header_value(const char *input
,
5 const char *correct_output
) {
8 decoded
= decode_header_value(input
);
9 TEST_DESTRUCTOR(free
, decoded
);
10 TEST_STRING_DUPLICITY(correct_output
, decoded
);
15 const char *inputs
[] = {
23 "(=?ISO-8859-1?Q?a?=)",
24 "(=?ISO-8859-1?Q?a?= b)",
25 "(a =?ISO-8859-1?Q?b?=)",
26 "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)",
27 "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)",
28 "(=?ISO-8859-1?Q?a?=\r\n =?ISO-8859-1?Q?b?=)",
29 "(=?ISO-8859-1?Q?a_b?=)",
30 "(=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)",
31 "=?UTF-8?B?SmVkbm9yw6F6b3bDvSBrw7NkIG9kZXNsw6FuLg==?=",
32 "=?ISO-8859-1?B?ZOlsa2E=?=",
33 "=?ISO-8859-1?Q?d=E9lka?="
35 const char *outputs
[] = {
51 "Jednorázový kód odeslán.",
56 INIT_TEST("HTTP header value decoder");
58 for (size_t i
= 0; i
< sizeof(inputs
)/sizeof(inputs
[0]); i
++) {
59 TEST(inputs
[i
], test_decode_header_value
, inputs
[i
], outputs
[i
]);
62 TEST("Empty string", test_decode_header_value
, "", "");
63 TEST("NULL pointer", test_decode_header_value
, NULL
, NULL
);