diff options
author | Bruce Wells <phpfui@users.noreply.github.com> | 2018-09-12 19:36:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 19:36:15 +0300 |
commit | 7a36e07736c04e620380fc6657888dca50ad8e31 (patch) | |
tree | 7b58c49eb788554db08ee8402bd014d10dae6b7b /tests | |
parent | 00def17f0e9183544813427cddbdaed851986309 (diff) | |
parent | 76d1b4b8f02d555e4b4f4fd4d641597f0f6b5f4e (diff) |
Merge branch 'master' into support_for_double_quoted_strings
Diffstat (limited to 'tests')
-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 |