summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test.c')
-rw-r--r--test.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/test.c b/test.c
index fc209b9..98e09d3 100644
--- a/test.c
+++ b/test.c
@@ -145,12 +145,54 @@ test_percent(void) {
}
}
+/******************/
+/* te parser test */
+/******************/
+
+static const char *
+te_parser_tests[] = {
+ "gzip",
+ "deflate",
+ "gzip,deflate,chunked",
+ "gzip, deflate, chunked",
+ "deflate , gzip , chunked ",
+ " deflate , gzip , chunked ",
+ NULL
+};
+
+static void
+test_te_parser(void) {
+ for (size_t i = 0; te_parser_tests[i]; i++) {
+ fhp_err_t err;
+
+ // get test string
+ const char *s = te_parser_tests[i];
+
+ // init parser
+ fhp_te_parser_t p;
+ fhp_te_parser_init(&p);
+
+ // parse data
+ if ((err = fhp_te_parser_push(&p, s, strlen(s))) != FHP_OK) {
+ die("test_te_parser", "fhp_te_parser_push", err);
+ }
+
+ // finish parsing
+ if ((err = fhp_te_parser_done(&p)) != FHP_OK) {
+ die("test_te_parser", "fhp_te_parser_push", err);
+ }
+
+ fprintf(stderr, "te test: \"%s\", p->num_tes = %u\n", s, p.num_tes);
+ }
+}
+
int main(int argc, char *argv[]) {
UNUSED(argc);
UNUSED(argv);
test_basic();
test_percent();
+ test_te_parser();
return EXIT_SUCCESS;
}