Add tests to try and break createNumber exponent handling

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1461698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-03-27 16:29:56 +00:00
parent d80be57d6e
commit a0f577f6aa
1 changed files with 21 additions and 3 deletions

View File

@ -239,6 +239,24 @@ public class NumberUtilsTest {
NumberUtils.createNumber("--1.1E-700F");
}
@Test(expected=NumberFormatException.class)
// Check that the code fails to create a valid number when both e and E are present (with decimal)
public void testCreateNumberFailure_2() {
NumberUtils.createNumber("-1.1E+0-7e00");
}
@Test(expected=NumberFormatException.class)
// Check that the code fails to create a valid number when both e and E are present (no decimal)
public void testCreateNumberFailure_3() {
NumberUtils.createNumber("-11E+0-7e00");
}
@Test(expected=NumberFormatException.class)
// Check that the code fails to create a valid number when both e and E are present (no decimal)
public void testCreateNumberFailure_4() {
NumberUtils.createNumber("1eE+00001");
}
// Tests to show when magnitude causes switch to next Number type
// Will probably need to be adjusted if code is changed to check precision (LANG-693)
@Test