aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kiryukhin <NeonXP@MacBook-Pro-Alexander.local>2016-04-01 17:24:34 +0300
committerAlexander Kiryukhin <NeonXP@MacBook-Pro-Alexander.local>2016-04-01 17:25:29 +0300
commitfa935b0af637fbda34454aa679c69eaaaba1308d (patch)
tree7c4633d0cee03cef810bb3f51dd6ef56fe065b70
parentfd7a113b956983e31abc1ce170fa7c6f2944f86d (diff)
+ Test for division by zero
-rw-r--r--tests/MathTest.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php
index 1b96ee2..f8a271e 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -27,6 +27,12 @@ class MathTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($calculator->execute($expression), $phpResult);
}
+ public function testZeroDevision()
+ {
+ $calculator = new MathExecutor();
+ $this->assertEquals($calculator->execute('1 / 0'), 0);
+ }
+
/**
* Expressions data provider
*/
@@ -62,4 +68,4 @@ class MathTest extends \PHPUnit_Framework_TestCase
array('100500 * 3.5E-5')
);
}
-} \ No newline at end of file
+}