public virtual void test_builder_invalid() { assertThrowsIllegalArg(() => HalfUpRounding.meta().builder().set(HalfUpRounding.meta().decimalPlaces(), -1).build()); assertThrowsIllegalArg(() => HalfUpRounding.meta().builder().set(HalfUpRounding.meta().decimalPlaces(), 257).build()); assertThrowsIllegalArg(() => HalfUpRounding.meta().builder().set(HalfUpRounding.meta().decimalPlaces(), 4).set(HalfUpRounding.meta().fraction(), -1).build()); assertThrowsIllegalArg(() => HalfUpRounding.meta().builder().set(HalfUpRounding.meta().decimalPlaces(), 4).set(HalfUpRounding.meta().fraction(), 257).build()); }
public virtual void test_ofFractionalDecimalPlaces_invalid() { assertThrowsIllegalArg(() => HalfUpRounding.ofFractionalDecimalPlaces(-1, 0)); assertThrowsIllegalArg(() => HalfUpRounding.ofFractionalDecimalPlaces(257, 0)); assertThrowsIllegalArg(() => HalfUpRounding.ofFractionalDecimalPlaces(0, -1)); assertThrowsIllegalArg(() => HalfUpRounding.ofFractionalDecimalPlaces(0, 257)); }
public virtual void test_builder() { HalfUpRounding test = HalfUpRounding.meta().builder().set(HalfUpRounding.meta().decimalPlaces(), 4).set(HalfUpRounding.meta().fraction(), 1).build(); assertEquals(test.DecimalPlaces, 4); assertEquals(test.Fraction, 0); assertEquals(test.ToString(), "Round to 4dp"); }
static HalfUpRounding() { for (int i = 0; i < 16; i++) { CACHE[i] = new HalfUpRounding(i, 0); } MetaBean.register(HalfUpRounding.Meta.INSTANCE); }
public virtual void test_ofFractionalDecimalPlaces() { HalfUpRounding test = HalfUpRounding.ofFractionalDecimalPlaces(4, 32); assertEquals(test.DecimalPlaces, 4); assertEquals(test.Fraction, 32); assertEquals(test.ToString(), "Round to 1/32 of 4dp"); assertEquals(Rounding.ofFractionalDecimalPlaces(4, 32), test); }
public virtual void test_ofDecimalPlaces_big() { HalfUpRounding test = HalfUpRounding.ofDecimalPlaces(40); assertEquals(test.DecimalPlaces, 40); assertEquals(test.Fraction, 0); assertEquals(test.ToString(), "Round to 40dp"); assertEquals(Rounding.ofDecimalPlaces(40), test); }
//------------------------------------------------------------------------- public virtual void coverage() { HalfUpRounding test = HalfUpRounding.ofDecimalPlaces(4); coverImmutableBean(test); HalfUpRounding test2 = HalfUpRounding.ofFractionalDecimalPlaces(4, 32); coverBeanEquals(test, test2); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @DataProvider(name = "round") public static Object[][] data_round() public static object[][] data_round() { return(new object[][] { new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3449, 12.34 }, new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3450, 12.35 }, new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3451, 12.35 }, new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3500, 12.35 }, new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3549, 12.35 }, new object[] { HalfUpRounding.ofDecimalPlaces(2), 12.3550, 12.36 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3424, 12.340 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3425, 12.345 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3426, 12.345 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3449, 12.345 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3450, 12.345 }, new object[] { HalfUpRounding.ofFractionalDecimalPlaces(2, 2), 12.3451, 12.345 } }); }
public virtual void test_ofDecimalPlaces_invalid() { assertThrowsIllegalArg(() => HalfUpRounding.ofDecimalPlaces(-1)); assertThrowsIllegalArg(() => HalfUpRounding.ofDecimalPlaces(257)); }
public virtual void test_serialization() { HalfUpRounding test = HalfUpRounding.ofDecimalPlaces(4); assertSerialization(test); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "round") public void round_BigDecimal_NONE(HalfUpRounding rounding, double input, double expected) public virtual void round_BigDecimal_NONE(HalfUpRounding rounding, double input, double expected) { assertEquals(rounding.round(decimal.valueOf(input)), decimal.valueOf(expected)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "round") public void round_double_NONE(HalfUpRounding rounding, double input, double expected) public virtual void round_double_NONE(HalfUpRounding rounding, double input, double expected) { assertEquals(rounding.round(input), expected); }