/** * @param integer $roundingMode The rounding mode. * @param BigInteger $number The number to round. * @param string $divisor The divisor. * @param string|null $ten The expected rounding to a scale of two, or null if an exception is expected. * @param string|null $hundred The expected rounding to a scale of one, or null if an exception is expected. * @param string|null $thousand The expected rounding to a scale of zero, or null if an exception is expected. */ private function doTestDividedByWithRoundingMode($roundingMode, BigInteger $number, $divisor, $ten, $hundred, $thousand) { foreach ([$ten, $hundred, $thousand] as $expected) { $divisor .= '0'; if ($expected === null) { $this->setExpectedException(RoundingNecessaryException::getNamespace()); } $actual = $number->dividedBy($divisor, $roundingMode); if ($expected !== null) { $this->assertBigIntegerEquals($expected, $actual); } } }