Code example for BigDecimal

Methods: equals, min

0
	public void test_minLjava_math_BigDecimal() { 
		BigDecimal min1 = new BigDecimal(-12345.4D);
		BigDecimal min2 = new BigDecimal(-12345.39D);
		assertTrue("-12345.39 should have been returned", min1.min(min2)
				.equals(min1));
		min1 = new BigDecimal(value2, 5);
		min2 = new BigDecimal(value2, 0);
		assertTrue("123345.6 should have been returned", min1.min(min2).equals(
				min1));
	} 
 
	/** 
	 * @tests java.math.BigDecimal#movePointLeft(int) 
	 */ 
	public void test_movePointLeftI() { 
		BigDecimal movePtLeft = new BigDecimal("123456265.34");
		BigDecimal alreadyMoved = movePtLeft.movePointLeft(5);
		assertTrue("move point left 5 failed", alreadyMoved.scale() == 7
				&& alreadyMoved.toString().equals("1234.5626534"));
		movePtLeft = new BigDecimal(value2.negate(), 0);
		alreadyMoved = movePtLeft.movePointLeft(12);