aboutsummaryrefslogtreecommitdiff
path: root/tests/MathTest.php
diff options
context:
space:
mode:
authorBruce Wells <phpfui@users.noreply.github.com>2018-09-12 19:36:15 +0300
committerGitHub <noreply@github.com>2018-09-12 19:36:15 +0300
commit7a36e07736c04e620380fc6657888dca50ad8e31 (patch)
tree7b58c49eb788554db08ee8402bd014d10dae6b7b /tests/MathTest.php
parent00def17f0e9183544813427cddbdaed851986309 (diff)
parent76d1b4b8f02d555e4b4f4fd4d641597f0f6b5f4e (diff)
Merge branch 'master' into support_for_double_quoted_strings
Diffstat (limited to 'tests/MathTest.php')
-rw-r--r--tests/MathTest.php12
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