mirror of
https://github.com/rafagafe/tiny-json.git
synced 2024-11-16 11:35:29 +00:00
More tests are added.
This commit is contained in:
parent
6b22d08c90
commit
f77812a288
23
tests.c
23
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 );
|
||||
@ -111,7 +111,6 @@ static int primitive( void ) {
|
||||
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 ) );
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user