aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2015-09-17 19:23:25 +0000
committerDominik Stadler <centic@apache.org>2015-09-17 19:23:25 +0000
commite47a129a5bb6a4ef21c44b82668bb981a7a1afac (patch)
tree6a9e5e6129dbd209d77e9b8a6d1bbfc970b6dbb4 /src/testcases
parent2f0ceddc7f019efd3b5418a94a8feda29af0fc1f (diff)
downloadpoi-e47a129a5bb6a4ef21c44b82668bb981a7a1afac.tar.gz
poi-e47a129a5bb6a4ef21c44b82668bb981a7a1afac.zip
Bug 57915: Fix Dev2Hex for numbers larger than Integer.MAX_VALUE and less than Integer.MIN_VALUE
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1703672 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java b/src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java
index f860aff2a5..e9b6c44e6a 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestDec2Hex.java
@@ -81,6 +81,28 @@ public final class TestDec2Hex extends TestCase {
confirmValue("Converts decimal -54 to hexadecimal, 2 is ignored","-54", "2", "FFFFFFFFCA");
confirmValue("places is optionnal","-54", "FFFFFFFFCA");
+
+ confirmValue("Converts normal decimal number to hexadecimal", "100", "64");
+
+ String maxInt = Integer.toString(Integer.MAX_VALUE);
+ assertEquals("2147483647", maxInt);
+ confirmValue("Converts INT_MAX to hexadecimal", maxInt, "7FFFFFFF");
+
+ String minInt = Integer.toString(Integer.MIN_VALUE);
+ assertEquals("-2147483648", minInt);
+ confirmValue("Converts INT_MIN to hexadecimal", minInt, "FF80000000");
+
+ String maxIntPlusOne = Long.toString(((long)Integer.MAX_VALUE)+1);
+ assertEquals("2147483648", maxIntPlusOne);
+ confirmValue("Converts INT_MAX + 1 to hexadecimal", maxIntPlusOne, "80000000");
+
+ String maxLong = Long.toString(549755813887l);
+ assertEquals("549755813887", maxLong);
+ confirmValue("Converts the max supported value to hexadecimal", maxLong, "7FFFFFFFFF");
+
+ String minLong = Long.toString(-549755813888l);
+ assertEquals("-549755813888", minLong);
+ confirmValue("Converts the min supported value to hexadecimal", minLong, "FF80000000");
}
public void testErrors() {