aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexander Kiryukhin <alexander@kiryukhin.su>2018-09-06 20:39:56 +0300
committerGitHub <noreply@github.com>2018-09-06 20:39:56 +0300
commitaa1a092a9e231e8f923ab40365dff092c2908903 (patch)
treec192d6dd2948e83122893ab67228141b271c2d22 /tests
parent855ca5dfc1a6d70d9872df4b0d7bea8ba3c4c040 (diff)
parent3011a1c55686ef5a0c7759ae1efcb2a71623ab9c (diff)
Merge pull request #26 from phpfui/getters_for_function_and_operators
Getters for function and operators
Diffstat (limited to 'tests')
-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