]> source.dussan.org Git - poi.git/commitdiff
Testcase for RKUtil
authorGlen Stampoultzis <glens@apache.org>
Mon, 22 Apr 2002 10:20:04 +0000 (10:20 +0000)
committerGlen Stampoultzis <glens@apache.org>
Mon, 22 Apr 2002 10:20:04 +0000 (10:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352462 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/util/RKUtil.java
src/testcases/org/apache/poi/hssf/util/TestRKUtil.java [new file with mode: 0644]

index f47b73ce6a595bac59bc402ad7f395f19cbbc093..54a9fd470580aa78b3119c7a021a3262e843861d 100644 (file)
@@ -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 (file)
index 0000000..eee91d4
--- /dev/null
@@ -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);
+    }
+}