aboutsummaryrefslogtreecommitdiff
path: root/tests/MathTest.php
diff options
context:
space:
mode:
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 a83a0d4..9bf8d97 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -74,4 +74,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