-
-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create BigDecimalParser4694Test.java (#1332)
- Loading branch information
1 parent
2864703
commit f26616c
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/test/java/com/fasterxml/jackson/failing/BigDecimalParser4694Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import ch.randelshofer.fastdoubleparser.JavaBigDecimalParser; | ||
import com.fasterxml.jackson.core.io.BigDecimalParser; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class BigDecimalParser4694Test extends com.fasterxml.jackson.core.JUnit5TestBase | ||
{ | ||
// https://github.com/FasterXML/jackson-databind/issues/4694 | ||
@Test | ||
void issueDatabind4694() { | ||
final String str = "-11000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; | ||
final BigDecimal expected = new BigDecimal(str); | ||
assertEquals(expected, JavaBigDecimalParser.parseBigDecimal(str)); | ||
assertEquals(expected, BigDecimalParser.parse(str)); | ||
assertEquals(expected, BigDecimalParser.parseWithFastParser(str)); | ||
final char[] arr = str.toCharArray(); | ||
assertEquals(expected, BigDecimalParser.parse(arr, 0, arr.length)); | ||
assertEquals(expected, BigDecimalParser.parseWithFastParser(arr, 0, arr.length)); | ||
} | ||
} |