aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java
index ba6fcf0..f69dca1 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java
@@ -17,6 +17,8 @@ limitations under the License.
package com.healthmarketscience.jackcess.impl;
+import java.math.BigDecimal;
+
import junit.framework.TestCase;
@@ -84,4 +86,21 @@ public class NumberFormatterTest extends TestCase
assertEquals("-1.#INF", NumberFormatter.format(Float.NEGATIVE_INFINITY));
assertEquals("1.#QNAN", NumberFormatter.format(Float.NaN));
}
+
+ public void testDecimalFormat() throws Exception
+ {
+ assertEquals("9874539485972.2342342234234", NumberFormatter.format(new BigDecimal("9874539485972.2342342234234")));
+ assertEquals("9874539485972.234234223423468", NumberFormatter.format(new BigDecimal("9874539485972.2342342234234678")));
+ assertEquals("-9874539485972.234234223423468", NumberFormatter.format(new BigDecimal("-9874539485972.2342342234234678")));
+ assertEquals("9.874539485972234234223423468E+31", NumberFormatter.format(new BigDecimal("98745394859722342342234234678000")));
+ assertEquals("9.874539485972234234223423468E+31", NumberFormatter.format(new BigDecimal("98745394859722342342234234678000")));
+ assertEquals("-9.874539485972234234223423468E+31", NumberFormatter.format(new BigDecimal("-98745394859722342342234234678000")));
+ assertEquals("300", NumberFormatter.format(new BigDecimal("300.0")));
+ assertEquals("-300", NumberFormatter.format(new BigDecimal("-300.000")));
+ assertEquals("0.3", NumberFormatter.format(new BigDecimal("0.3")));
+ assertEquals("0.1", NumberFormatter.format(new BigDecimal("0.1000")));
+ assertEquals("0.0000000000023423428930458", NumberFormatter.format(new BigDecimal("0.0000000000023423428930458")));
+ assertEquals("2.3423428930458389038451E-12", NumberFormatter.format(new BigDecimal("0.0000000000023423428930458389038451")));
+ assertEquals("2.342342893045838903845134766E-12", NumberFormatter.format(new BigDecimal("0.0000000000023423428930458389038451347656")));
+ }
}