1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

added unit test for json parser

This commit is contained in:
Falk Werner
2020-07-12 16:03:38 +02:00
parent fd70fa73ac
commit fe32a31e09
2 changed files with 93 additions and 1 deletions

View File

@@ -16,6 +16,11 @@ wfp_impl_json_parse_value(
struct wfp_json_reader * reader,
struct wfp_json * json);
static bool
wfp_impl_json_parse_null(
struct wfp_json_reader * reader,
struct wfp_json * json);
static bool
wfp_impl_json_parse_true(
struct wfp_json_reader * reader,
@@ -92,6 +97,8 @@ wfp_impl_json_parse_value(
switch (c)
{
case 'n':
return wfp_impl_json_parse_null(reader, json);
case 't':
return wfp_impl_json_parse_true(reader, json);
case 'f':
@@ -116,6 +123,20 @@ wfp_impl_json_parse_value(
}
}
static bool
wfp_impl_json_parse_null(
struct wfp_json_reader * reader,
struct wfp_json * json)
{
bool const result = wfp_impl_json_reader_read_const(reader, "ull", 3);
if (result)
{
json->type = WFP_JSON_NULL;
}
return result;
}
static bool
wfp_impl_json_parse_true(
struct wfp_json_reader * reader,