garydgregory commented on code in PR #1712:
URL: https://github.com/apache/commons-lang/pull/1712#discussion_r3430662369
##########
src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java:
##########
@@ -661,6 +661,13 @@ void testCreateNumber() {
assertEquals(Integer.decode("+0xF"), NumberUtils.createNumber("+0xF"),
"createNumber(String) LANG-1645a failed");
assertEquals(Long.decode("+0xFFFFFFFF"),
NumberUtils.createNumber("+0xFFFFFFFF"), "createNumber(String) LANG-1645b
failed");
assertEquals(new BigInteger("+FFFFFFFFFFFFFFFF", 16),
NumberUtils.createNumber("+0xFFFFFFFFFFFFFFFF"), "createNumber(String)
LANG-1645c failed");
+ // A hex literal too large for a Long but carrying an explicit 'L'/'l'
type suffix must drop the suffix
+ // before falling back to BigInteger, matching the decimal path (e.g.
"12345678901234567890L").
+ assertEquals(new BigInteger("FFFFFFFFFFFFFFFF", 16),
NumberUtils.createNumber("0xFFFFFFFFFFFFFFFFL"));
+ assertEquals(new BigInteger("FFFFFFFFFFFFFFFF", 16),
NumberUtils.createNumber("0xFFFFFFFFFFFFFFFFl"));
+ assertEquals(new BigInteger("8000000000000000", 16),
NumberUtils.createNumber("0x8000000000000000L"));
+ assertEquals(new BigInteger("-FFFFFFFFFFFFFFFF", 16),
NumberUtils.createNumber("-0xFFFFFFFFFFFFFFFFL"));
+ assertEquals(new BigInteger("FFFFFFFFFFFFFFFF", 16),
NumberUtils.createNumber("#FFFFFFFFFFFFFFFFL"));
// Map to a BigDecimal, not a Float.
Review Comment:
@sarankumarbaskar
You wrote "and the added tests fail without the production change."
If I add the test only side of the patch, ALL of the new BigInteger
assertions in this patch fail. So what are you talking about?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]