test: Silent warnings in offile tests
[libisds.git] / test / offline / soap-decode_header_value.c
blobf8d919ef895664feb502536fa7c3f75e82c5fd39
1 #include "../test.h"
2 #include "soap.c"
4 static int test_decode_header_value(const char *input,
5 const char *correct_output) {
6 char *decoded;
8 decoded = decode_header_value(input);
9 TEST_DESTRUCTOR(free, decoded);
10 TEST_STRING_DUPLICITY(correct_output, decoded);
11 PASS_TEST;
14 int main(void) {
15 const char *inputs[] = {
16 "foo",
17 " foo ",
18 "foo bar",
19 "foo bar",
20 "foo\r\n bar",
21 "foo\r\n\tbar",
22 "foo \r\n bar",
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[] = {
36 "foo",
37 "foo",
38 "foo bar",
39 "foo bar",
40 "foo bar",
41 "foo bar",
42 "foo bar",
43 "(a)",
44 "(a b)",
45 "(a b)",
46 "(ab)",
47 "(ab)",
48 "(ab)",
49 "(a b)",
50 "(a b)",
51 "Jednorázový kód odeslán.",
52 "délka",
53 "délka"
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);
65 SUM_TEST();