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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user