diff options
author | Bruce Wells <bruce.wells@simparel.com> | 2018-09-12 18:55:31 +0300 |
---|---|---|
committer | Bruce Wells <bruce.wells@simparel.com> | 2018-09-12 19:33:17 +0300 |
commit | 00def17f0e9183544813427cddbdaed851986309 (patch) | |
tree | fcc3e47fdf11465e2566e9c6f71e7a80488da6a8 /tests/MathTest.php | |
parent | 855ca5dfc1a6d70d9872df4b0d7bea8ba3c4c040 (diff) |
Support for double quoted strings
Changed array() to [] syntax.
Added variable in question to unknown variable exception.
Added getVar and getVars accessor functions.
Added getOperators and getFunctions accessor functions for completeness.
Extended all Exceptions off MathExecutorException.
Diffstat (limited to 'tests/MathTest.php')
-rw-r--r-- | tests/MathTest.php | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index a83a0d4..3fa7270 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -27,7 +27,7 @@ class MathTest extends \PHPUnit_Framework_TestCase $this->assertEquals($calculator->execute($expression), $phpResult); } - public function testZeroDevision() + public function testZeroDivision() { $calculator = new MathExecutor(); $this->assertEquals($calculator->execute('1 / 0'), 0); @@ -44,34 +44,34 @@ class MathTest extends \PHPUnit_Framework_TestCase */ public function providerExpressions() { - return array( - array('0.1 + 0.2'), - array('1 + 2'), + return [ + ['0.1 + 0.2'], + ['1 + 2'], - array('0.1 - 0.2'), - array('1 - 2'), + ['0.1 - 0.2'], + ['1 - 2'], - array('0.1 * 2'), - array('1 * 2'), + ['0.1 * 2'], + ['1 * 2'], - array('0.1 / 0.2'), - array('1 / 2'), + ['0.1 / 0.2'], + ['1 / 2'], - array('2 * 2 + 3 * 3'), + ['2 * 2 + 3 * 3'], - array('1 + 0.6 - 3 * 2 / 50'), + ['1 + 0.6 - 3 * 2 / 50'], - array('(5 + 3) * -1'), + ['(5 + 3) * -1'], - array('2+2*2'), - array('(2+2)*2'), - array('(2+2)*-2'), - array('(2+-2)*2'), + ['2+2*2'], + ['(2+2)*2'], + ['(2+2)*-2'], + ['(2+-2)*2'], - array('sin(10) * cos(50) / min(10, 20/2)'), + ['sin(10) * cos(50) / min(10, 20/2)'], - array('100500 * 3.5E5'), - array('100500 * 3.5E-5') - ); + ['100500 * 3.5E5'], + ['100500 * 3.5E-5'], + ]; } } |