From f77812a28875bbc8f102b1e5d50b514d53cfedb5 Mon Sep 17 00:00:00 2001 From: rafagafe Date: Tue, 4 Apr 2017 01:38:06 +0200 Subject: [PATCH] More tests are added. --- tests.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests.c b/tests.c index a1517e0..e7c8821 100644 --- a/tests.c +++ b/tests.c @@ -59,13 +59,13 @@ static int primitive( void ) { unsigned const qty = sizeof pool / sizeof *pool; { char str[] = "{" - "\"real\": -0.004," + "\"max\": 9223372036854775807," + "\"min\": -9223372036854775808," "\"boolvar0\": false," "\"boolvar1\": true," "\"nullvar\": null," - "\"max\": 9223372036854775807," - "\"min\": -9223372036854775808," "\"scientific\": 5368.32e-3," + "\"real\": -0.004," "}"; json_t const* json = json_create( str, pool, qty ); @@ -110,8 +110,7 @@ static int primitive( void ) { check( scientific ); check( JSON_REAL == json_getType( scientific ) ); check( !strcmp( "5368.32e-3", json_getValue( scientific ) ) ); - check( 5368.32e-3 == json_getReal( scientific ) ); - printf( "%s - %f\n", json_getValue( scientific ), json_getReal( scientific ) ); + check( 5368.32e-3 == json_getReal( scientific ) ); } @@ -203,6 +202,22 @@ int badformat( void ) { json_t const* json = json_create( str, pool, qty ); check( !json ); } + { + char str[] = "{\"var\":9223372036854775808}"; + json_t const* json = json_create( str, pool, qty ); + check( !json ); + } + { + char str[] = "{\"var\":-9223372036854775809}"; + json_t const* json = json_create( str, pool, qty ); + check( !json ); + } + { + char str[] = "{\"var\":9}"; + json_t const* json = json_create( str, pool, qty ); + check( json ); + } + done(); }