diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-23 15:31:28 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-27 11:45:01 +0200 |
| commit | a44ce5c6f74fb777408b455ae21ca545447c0ade (patch) | |
| tree | cc2bcf4713f4dcb48456be6396e4f7bf6d974733 /tests/test_json.c | |
| parent | 03b645f22bfc7afadc5a8aa6d59edf0eba74a048 (diff) | |
json: parse negative numbers
Diffstat (limited to 'tests/test_json.c')
| -rw-r--r-- | tests/test_json.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_json.c b/tests/test_json.c index e050c72..1aec8c5 100644 --- a/tests/test_json.c +++ b/tests/test_json.c @@ -216,3 +216,15 @@ i32 test_json_complex_multiline() { return 0; } + +i32 test_negative_numbers() { + Arena perm = Arena_new(128e3); + JSON doc = JSON_parse_raw(&perm, "[-1, -2.5]"); + + JSON integer = *Vec_get(doc.as.array, JSON, 0); + t_assert(integer.as.integer == -1); + JSON floating = *Vec_get(doc.as.array, JSON, 1); + t_assert(floating.as.floating == -2.5); + + return 0; +} |
