public void modifyDecimal(IonDecimal value) { float fVal = 123.45F; value.setValue(fVal); assertEquals(fVal, value.floatValue()); assertEquals((double) fVal, value.doubleValue()); assertEquals(fVal, value.bigDecimalValue().floatValue()); value.setValue(A_DOUBLE); assertEquals(A_DOUBLE, value.doubleValue()); assertEquals(A_DOUBLE, value.bigDecimalValue().doubleValue()); value.setValue(null); checkNullDecimal(value); }
@Test public void testNegativeZero() { IonDecimal value = decimal("-0."); testNegativeZero(0, value); IonDecimal value2 = decimal("-0d2"); assertFalse(value2.equals(value)); testNegativeZero(-2, value2); value2 = decimal("-0d1"); assertFalse(value2.equals(value)); testNegativeZero(-1, value2); value2 = decimal("1."); value2.setValue(-0f); testNegativeZero(1, value2); value2 = decimal("1."); value2.setValue(-0d); testNegativeZero(1, value2); }
@Test public void testSetValue() { IonDecimal value = decimal("1.23"); value.setValue(123); checkDecimal(123, 0, value.bigDecimalValue()); }