Пример #1
0
  public void checkEquality(boolean expected, String v1, String v2) {
    IonDecimal d1 = decimal(v1);
    IonDecimal d2 = decimal(v2);

    assertEquals(expected, d1.equals(d2));
    assertEquals(expected, d2.equals(d1));
  }
Пример #2
0
  @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);
  }