diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MathTest.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index 1b96ee2..2b2727f 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -62,4 +62,14 @@ class MathTest extends \PHPUnit_Framework_TestCase array('100500 * 3.5E-5') ); } + + public function testFunction() + { + $calculator = new MathExecutor(); + + $calculator->addFunction('round', function ($arg) { return round($arg); }, 1); + /** @var float $phpResult */ + eval('$phpResult = round(100/30);'); + $this->assertEquals($calculator->execute('round(100/30)'), $phpResult); + } }
\ No newline at end of file |