diff options
author | Zhong Sheng <nicky_zs@163.com> | 2015-05-28 23:47:57 +0800 |
---|---|---|
committer | Zhong Sheng <nicky_zs@163.com> | 2015-05-28 23:47:57 +0800 |
commit | 31d08571bb19bb7b16197476a1c2f7dc319e3ba2 (patch) | |
tree | f4047005ded6007ebee31d02cf3852be7f38e4b5 /test/junit | |
parent | 4d2a92c0dcf5f18bd7c77c2ae4b7a04c2e472a03 (diff) | |
download | scala-31d08571bb19bb7b16197476a1c2f7dc319e3ba2.tar.gz scala-31d08571bb19bb7b16197476a1c2f7dc319e3ba2.tar.bz2 scala-31d08571bb19bb7b16197476a1c2f7dc319e3ba2.zip |
add unit test for MathContext lost
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/math/BigDecimalTest.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/junit/scala/math/BigDecimalTest.scala b/test/junit/scala/math/BigDecimalTest.scala index c7a63da890..dedf2e242e 100644 --- a/test/junit/scala/math/BigDecimalTest.scala +++ b/test/junit/scala/math/BigDecimalTest.scala @@ -228,4 +228,11 @@ class BigDecimalTest { def test_SI8970() { assert((0.1).## == BigDecimal(0.1).##) } + + // Motivated by the problem of MathContext lost + @Test + def testMathContext() { + assert(BigDecimal(1.1d, MC.UNLIMITED).pow(1000) == BigDecimal("1.1", MC.UNLIMITED).pow(1000)) + assert((BigDecimal(1.23d, new MC(3)) + BigDecimal("0.005")).rounded == BigDecimal("1.24")) + } } |