Debian Codegraph @

tests/unit/test_clean_uncgi.template

raw
1 /**
2 * This file is part of the Detox package.
3 *
4 * Copyright (c) Doug Harple <[email protected]>
5 *
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
8 */
9
10 #include <string.h>
11
12 #include "clean_string.h"
13
14 #include "unit_struct.h"
15
16 #define DATA_COUNT 10
17 static struct test_filename data[DATA_COUNT] = {
18
19 // legacy tests
20
21 { .filename = "%3Dequals", .expected = "=equals" },
22 { .filename = "%25percent", .expected = "%percent" },
23 { .filename = "%3Fquestion%20mark", .expected = "?question mark" },
24 { .filename = "%2bplus", .expected = "+plus" },
25 { .filename = "%2ccomma", .expected = ",comma" },
26 { .filename = "%2Fslash", .expected = "/slash" },
27
28 // full coverage
29
30 { .filename = "lower", .expected = "lower" },
31 { .filename = "%20space", .expected = " space" },
32 { .filename = "UPPER%3ALOWER", .expected = "UPPER:LOWER" },
33 { .filename = "here+and+there", .expected = "here and there" },
34
35 };
36
37 #test test_clean_uncgi
38 char *output;
39 int i;
40
41 for (i = 0; i < DATA_COUNT; i++) {
42 output = clean_uncgi(data[i].filename);
43 ck_assert_str_eq(output, data[i].expected);
44 }
45
46 #test test_clean_uncgi_null
47 char *output;
48
49 // confirm NULL works
50 output = clean_uncgi(NULL);
51 ck_assert(output == NULL);