From: Glen Stampoultzis Date: Mon, 22 Apr 2002 10:20:04 +0000 (+0000) Subject: Testcase for RKUtil X-Git-Tag: REL_1_5_0~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0eaa163e10c69b43c24d4743ba573feaca44eaa7;p=poi.git Testcase for RKUtil git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352462 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/util/RKUtil.java b/src/java/org/apache/poi/hssf/util/RKUtil.java index f47b73ce6a..54a9fd4705 100644 --- a/src/java/org/apache/poi/hssf/util/RKUtil.java +++ b/src/java/org/apache/poi/hssf/util/RKUtil.java @@ -87,7 +87,7 @@ public class RKUtil if ((number & 0x02) == 0x02) { // ok, it's just a plain ol' int; we can handle this - // trivially by right-shifting and casting + // trivially by casting rvalue = ( double ) (raw_number); } else @@ -106,6 +106,7 @@ public class RKUtil // hall, especially if it's the city of Redmond rvalue /= 100; } + return rvalue; } diff --git a/src/testcases/org/apache/poi/hssf/util/TestRKUtil.java b/src/testcases/org/apache/poi/hssf/util/TestRKUtil.java new file mode 100644 index 0000000000..eee91d48c4 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/util/TestRKUtil.java @@ -0,0 +1,20 @@ +package org.apache.poi.hssf.util; + +import junit.framework.TestCase; + +public class TestRKUtil + extends TestCase +{ + public TestRKUtil(String s) + { + super(s); + } + + public void testDecode() + throws Exception + { + assertEquals(3.0, RKUtil.decodeNumber(1074266112), 0.0000001); + assertEquals(3.3, RKUtil.decodeNumber(1081384961), 0.0000001); + assertEquals(3.33, RKUtil.decodeNumber(1081397249), 0.0000001); + } +}