Skip to content

Commit de917ac

Browse files
committed
Improve test coverage.
1 parent 4b9d903 commit de917ac

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/test/json/create.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ namespace tao
257257
test_double( 0.0 );
258258
test_double( 42.0 );
259259

260+
value v;
261+
262+
const double a = std::numeric_limits< double >::infinity();
263+
const double b = std::numeric_limits< double >::quiet_NaN();
264+
const double c = std::numeric_limits< double >::signaling_NaN();
265+
266+
TEST_THROWS( v = a );
267+
TEST_THROWS( v = b );
268+
TEST_THROWS( v = c );
269+
260270
test_string( "" );
261271
test_string( "foo" );
262272
test_string( "abcdefghijklmnpqrstuvwxyz" );

src/test/json/parse.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ namespace tao
8080
// TODO: test_int64()
8181
test_array();
8282
test_object();
83+
84+
TEST_THROWS( from_string( "" ) );
85+
TEST_THROWS( from_string( "[" ) );
86+
TEST_THROWS( from_string( "{" ) );
87+
TEST_THROWS( from_string( "]" ) );
88+
TEST_THROWS( from_string( "}" ) );
89+
TEST_THROWS( from_string( "'" ) );
90+
TEST_THROWS( from_string( "\"" ) );
91+
TEST_THROWS( from_string( "..." ) );
92+
TEST_THROWS( from_string( "\"\xfd\xbf\xbf\xbf\xbf" ) );
93+
TEST_THROWS( from_string( "\"\xfd\xbf\xbf\xbf\xbf\"" ) );
94+
TEST_THROWS( from_string( "\"\xfd\xbf\xbf\xbf\xbf\xbf" ) );
95+
TEST_THROWS( from_string( "\"\xfd\xbf\xbf\xbf\xbf\xbf\"" ) );
8396
}
8497

8598
} // json

0 commit comments

Comments
 (0)