aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/MathTest.php10
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