diff options
author | Bruce Wells <brucekwells@gmail.com> | 2020-05-20 05:36:55 +0300 |
---|---|---|
committer | Bruce Wells <brucekwells@gmail.com> | 2020-05-20 05:36:55 +0300 |
commit | b95ab24f367baf928332dc5040ab444c1c719623 (patch) | |
tree | 20f7030e732f039263c9a2a4dfb5855d1b12cdeb /tests/MathTest.php | |
parent | ab3a44b33031d86c74cc8f07c9d904d8d20c7da9 (diff) |
setDivisionByZeroIsZero
Diffstat (limited to 'tests/MathTest.php')
-rw-r--r-- | tests/MathTest.php | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php index 958f14c..39ac649 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -203,7 +203,7 @@ class MathTest extends TestCase ['(-3 * -1)'], ['1 + (-3 * -1)'], ['1 + ( -3 * 1)'], - ['1 + (3 * -1)'], + ['1 + (3 *-1)'], ['1 - 0'], ['1-0'], ]; @@ -226,12 +226,7 @@ class MathTest extends TestCase public function testZeroDivision() { $calculator = new MathExecutor(); - $calculator->addOperator(new Operator("/", false, 180, function ($a, $b) { - if ($b == 0) { - return 0; - } - return $a / $b; - })); + $calculator->setDivisionByZeroIsZero(); $this->assertEquals(0, $calculator->execute('10 / 0')); } |