Exemple #1
0
 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));
 }
Exemple #2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            HalfUpRounding test = HalfUpRounding.ofDecimalPlaces(4);

            coverImmutableBean(test);
            HalfUpRounding test2 = HalfUpRounding.ofFractionalDecimalPlaces(4, 32);

            coverBeanEquals(test, test2);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        //-------------------------------------------------------------------------
//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 }
            });
        }