aboutsummaryrefslogtreecommitdiff
path: root/tests/MathTest.php
diff options
context:
space:
mode:
authorBruce Wells <bruce.wells@simparel.com>2018-09-12 18:55:31 +0300
committerBruce Wells <bruce.wells@simparel.com>2018-09-12 19:33:17 +0300
commit00def17f0e9183544813427cddbdaed851986309 (patch)
treefcc3e47fdf11465e2566e9c6f71e7a80488da6a8 /tests/MathTest.php
parent855ca5dfc1a6d70d9872df4b0d7bea8ba3c4c040 (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.php42
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'],
+ ];
}
}