1
0
mirror of https://github.com/danog/math.git synced 2024-11-30 04:19:31 +01:00
math/tests/AbstractTestCase.php
Benjamin Morel 321c00281d CS fixes
Shorthand "int" and "bool" are now used instead of "integer" and "boolean".
This makes more sense as the latter are not accepted as synonyms in PHP 7 scalar type hints and return types.
2015-06-21 14:37:51 +02:00

45 lines
1.4 KiB
PHP

<?php
namespace Brick\Math\Tests;
use Brick\Math\BigDecimal;
use Brick\Math\BigInteger;
use Brick\Math\BigRational;
/**
* Base class for BigInteger and BigDecimal test cases.
*/
abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
/**
* @param string $expected The expected value as a string.
* @param BigInteger $actual The BigInteger instance to test.
*/
protected function assertBigIntegerEquals($expected, BigInteger $actual)
{
$this->assertSame($expected, (string) $actual);
}
/**
* @param string $unscaledValue The expected unscaled value.
* @param int $scale The expected scale.
* @param BigDecimal $actual The BigDecimal instance to test.
*/
protected function assertBigDecimalEquals($unscaledValue, $scale, BigDecimal $actual)
{
$this->assertSame($unscaledValue, $actual->getUnscaledValue());
$this->assertSame($scale, $actual->getScale());
}
/**
* @param string $numerator
* @param string $denominator
* @param BigRational $actual
*/
protected function assertBigRationalEquals($numerator, $denominator, BigRational $actual)
{
$this->assertSame($numerator, (string) $actual->getNumerator());
$this->assertSame($denominator, (string) $actual->getDenominator());
}
}