aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClément Lafont <johnrazeur@gmail.com>2020-02-07 19:05:26 +0300
committerGitHub <noreply@github.com>2020-02-07 19:05:26 +0300
commit43790a456e8ec4104895869b178165fec65613d7 (patch)
tree7e00d08ffef0673b4ece2d1a547008779bbe43cb /tests
parent707e22029d8bcfc93918eaca27905d14e376d3b5 (diff)
Fix substraction by zero bug (#56)
Diffstat (limited to 'tests')
-rw-r--r--tests/MathTest.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php
index 3e5a7ff..1ffa5ae 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -304,4 +304,11 @@ class MathTest extends \PHPUnit\Framework\TestCase
$this->assertEquals(-4, $calculator->execute('(-4)'));
$this->assertEquals(1, $calculator->execute('(-4 + 5)'));
}
+
+ public function testMinusZero()
+ {
+ $calculator = new MathExecutor();
+ $this->assertEquals(1, $calculator->execute('1 - 0'));
+ $this->assertEquals(1, $calculator->execute('1-0'));
+ }
}