diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2018-06-06 02:54:13 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2018-06-06 02:54:13 +0000 |
commit | 0b5f764325222755fc82190b3481a0637d23cbed (patch) | |
tree | f48649cbda3e9dddd49e64b47aaced8e1f5d701c | |
parent | 94ada64785a774620ee5aea934e16ea914b50a2c (diff) | |
download | jackcess-0b5f764325222755fc82190b3481a0637d23cbed.tar.gz jackcess-0b5f764325222755fc82190b3481a0637d23cbed.zip |
more number format unit tests
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1164 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/impl/NumberFormatterTest.java | 19 |
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"))); + } } |