mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Add mg_json_get_long
This commit is contained in:
1 parent
86e57d243d
commit
c5751b0bd3
6 files changed
+42
No files matched your search
@@ -2373,6 +2373,9 @@ static void test_json(void) {
|
||||
ASSERT(strcmp(str, "hi\nthere") == 0);
|
||||
free(str);
|
||||
|
||||
ASSERT(mg_json_get_long(mg_str(json), "$.foo", -42) == -42);
|
||||
ASSERT(mg_json_get_long(mg_str(json), "$.b[0]", -42) == 12345);
|
||||
|
||||
ASSERT(mg_json_get_num(mg_str(json), "$.a", &d) == false);
|
||||
ASSERT(mg_json_get_num(mg_str(json), "$.c", &d) == false);
|
||||
ASSERT(mg_json_get_num(mg_str(json), "$.b[0]", &d) == true);
|
||||
|
||||
Reference in new issue
Block a user