From 31d08571bb19bb7b16197476a1c2f7dc319e3ba2 Mon Sep 17 00:00:00 2001 From: Zhong Sheng Date: Thu, 28 May 2015 23:47:57 +0800 Subject: add unit test for MathContext lost --- test/junit/scala/math/BigDecimalTest.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/junit') 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")) + } } -- cgit v1.2.3