1
0
mirror of https://github.com/danog/math.git synced 2024-11-30 04:19:31 +01:00
math/tests/AbstractTestCase.php
2015-01-27 17:38:31 +01:00

33 lines
988 B
PHP

<?php
namespace Brick\Math\Tests;
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());
}
}