Skip to content

Commit

Permalink
Add a test wrt #677
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 5, 2021
1 parent 905919f commit 5de0c67
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,35 @@ public void testFloatBoundary146Bytes() throws Exception
}
}

/*
/**********************************************************************
/* Tests, BigDecimal (core#677)
/**********************************************************************
*/

public void testBigBigDecimals() throws Exception
{
_testBigBigDecimals(MODE_INPUT_STREAM);
_testBigBigDecimals(MODE_INPUT_STREAM_THROTTLED);
_testBigBigDecimals(MODE_READER);
_testBigBigDecimals(MODE_DATA_INPUT);
}

private void _testBigBigDecimals(int mode) throws Exception
{
for (String asText : new String[] {
"50.016102539344819307741514415079435545110277821887074630242881493528776023690905378058352283823814945584087486290764920313665152884137840533937075179853255596515758851877960056849468879933122908090021571162427934915567330612627267701300492535817858361072169790783434196345863626810981153268939825893279523570322533446766188724600595265286542918045850353371520018451295635609248478721067200812355632099802713302132804777044107393832707173313768807959788098545050700242134577863569636367439867566923334792774940569273585734964008310245010584348384920574103306733020525390136397928777667088202296433541706175886006626333525007680397351405390927420825851036548474519239425298649420795296781692303253055152441850691276044546565109657012938963181532017974206315159305959543881191233733179735321461579808278383770345759408145745617032705494900390986476773247981270283533959979287340513398944113566999839889290733896874439682249327621463735375868408190435590094166575473967368412983975580104741004390308453023021214626015068027388545767003666342291064051883531202983476423138817666738346033272948508395214246047027012105246939488877506475824651688812245962816086719050192476878886543996441778751825677213412487177484703116405390741627076678284295993334231429145515176165808842776515287299275536932744066126348489439143701880784521312311735178716650919024092723485314329094064704170548551468318250179561508293077056611877488417962195965319219352314664764649802231780262169742484818333055713291103286608643184332535729978330383356321740509817475633105247757622805298711765784874873240679024286215940395303989612556865748135450980540945799394622053158729350598632915060818702520420240989908678141379300904169936776618861221839938283876222332124814830207073816864076428273177778788053613345444299361357958409716099682468768353446625063"
}) {
final String DOC = "[ "+asText+" ]";

JsonParser p = createParser(mode, DOC);
assertToken(JsonToken.START_ARRAY, p.nextToken());
assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
final BigDecimal exp = new BigDecimal(asText);
assertEquals(exp, p.getDecimalValue());
}
}

/*
/**********************************************************************
/* Tests, misc other
Expand Down

0 comments on commit 5de0c67

Please sign in to comment.