2014-08-31 14:13:46 +02:00
|
|
|
<?php
|
|
|
|
|
2014-08-31 14:24:10 +02:00
|
|
|
namespace Brick\Math\Tests;
|
2014-08-31 14:13:46 +02:00
|
|
|
|
|
|
|
use Brick\Math\BigDecimal;
|
|
|
|
use Brick\Math\BigInteger;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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) BigInteger::of($actual));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $unscaledValue The expected unscaled value.
|
|
|
|
* @param integer $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());
|
|
|
|
}
|
|
|
|
}
|