diff options
Diffstat (limited to 'tests/MathTest.php')
-rw-r--r-- | tests/MathTest.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index 3fa7270..db6e486 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -74,4 +74,14 @@ class MathTest extends \PHPUnit_Framework_TestCase ['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 |