Skip to content

Commit

Permalink
Create BigDecimalParser4694Test.java (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored and cowtowncoder committed Sep 12, 2024
1 parent 2864703 commit f26616c
Showing 1 changed file with 25 additions and 0 deletions.
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));
}
}

0 comments on commit f26616c

Please sign in to comment.