diff options
author | Bruce Wells <bruce.wells@simparel.com> | 2018-10-25 18:42:11 +0300 |
---|---|---|
committer | Bruce Wells <bruce.wells@simparel.com> | 2018-10-25 18:43:57 +0300 |
commit | 334dd26e3c78a36002aed34aa26aa526b11c5dfb (patch) | |
tree | 28a0abef9e0e48df01660985339e93c69a2cd746 /tests | |
parent | b9f72a001bca4772a003248595ad20b13a5b2277 (diff) |
Removing DivisionByZeroException testing for now
Added more unit tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MathTest.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index df073b2..c8b8a03 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -52,8 +52,11 @@ class MathTest extends \PHPUnit_Framework_TestCase public function testZeroDivision() { $calculator = new MathExecutor(); - $this->expectException(DivisionByZeroException::class); - $calculator->execute('1 / 0'); + $this->assertEquals($calculator->execute('1 / 0'), 0); + + // future version with allow for optional exceptions on divide by zero + // $this->expectException(DivisionByZeroException::class); + // $calculator->execute('1 / 0'); } public function testExponentiation() @@ -86,15 +89,25 @@ class MathTest extends \PHPUnit_Framework_TestCase ['(5 + 3) * -1'], - ['2+2*2'], + ['2- 2*2'], + ['2-(2*2)'], + ['(2- 2)*2'], + ['2 + 2*2'], + ['2+ 2*2'], ['(2+2)*2'], - ['(2+2)*-2'], + ['(2 + 2)*-2'], ['(2+-2)*2'], ['sin(10) * cos(50) / min(10, 20/2)'], ['100500 * 3.5E5'], ['100500 * 3.5E-5'], + + ['-1 + -2'], + ['-1+-2'], + ['-1- -2'], + ['-1/-2'], + ['-1*-2'], ]; } |