summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-28 00:20:02 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-28 00:20:02 -0400
commit1bc717dc54b9964e7c62082b34d2d74e3daaa6a6 (patch)
treec528c5acdba586f9642ad9e96e454bcde16879ab /test.c
parentf0668928544479c030e05d7cfc87f0c392a6d065 (diff)
downloadlibfhp-1bc717dc54b9964e7c62082b34d2d74e3daaa6a6.tar.bz2
libfhp-1bc717dc54b9964e7c62082b34d2d74e3daaa6a6.zip
add te parser (not working)
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;
}