mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-06 04:55:50 +01:00
Some more tests
This commit is contained in:
parent
4e9b4f6d6a
commit
7acbb87c2b
@ -449,7 +449,8 @@ TEST(Reader, ParseNumber_NormalPrecisionError) {
|
||||
TEST(Reader, ParseNumber_Error) {
|
||||
#define TEST_NUMBER_ERROR(errorCode, str, errorOffset, streamPos) \
|
||||
{ \
|
||||
char buffer[1001]; \
|
||||
char buffer[2048]; \
|
||||
ASSERT_LT(std::strlen(str), 2048u); \
|
||||
sprintf(buffer, "%s", str); \
|
||||
InsituStringStream s(buffer); \
|
||||
BaseReaderHandler<> h; \
|
||||
@ -498,6 +499,41 @@ TEST(Reader, ParseNumber_Error) {
|
||||
"03685473724737236837236775297525854775297525472975254737236873720170151235473783"
|
||||
"7236737247372368772473723683723456789012E66", 0, 283);
|
||||
|
||||
// Half way between max-normal and infinity
|
||||
// Should round to infinity in nearest-even mode.
|
||||
TEST_NUMBER_ERROR(kParseErrorNumberTooBig,
|
||||
"1.797693134862315807937289714053034150799341327100378269361737789804449682927647"
|
||||
"50946649017977587207096330286416692887910946555547851940402630657488671505820681"
|
||||
"90890200070838367627385484581771153176447573027006985557136695962284291481986083"
|
||||
"49364752927190741684443655107043427115596995080930428801779041744977920000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000e+308", 0, 1125);
|
||||
// ...round up
|
||||
TEST_NUMBER_ERROR(kParseErrorNumberTooBig,
|
||||
"1.797693134862315807937289714053034150799341327100378269361737789804449682927647"
|
||||
"50946649017977587207096330286416692887910946555547851940402630657488671505820681"
|
||||
"90890200070838367627385484581771153176447573027006985557136695962284291481986083"
|
||||
"49364752927190741684443655107043427115596995080930428801779041744977920000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000001e+308", 0, 1125);
|
||||
|
||||
#undef TEST_NUMBER_ERROR
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user