From a44ce5c6f74fb777408b455ae21ca545447c0ade Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sat, 23 Aug 2025 15:31:28 +0200 Subject: json: parse negative numbers --- tests/test_json.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_json.c') 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; +} -- cgit v1.3