aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJavier Marín <contacto@ideatic.net>2022-01-05 11:53:06 +0300
committerJavier Marín <contacto@ideatic.net>2022-01-05 11:53:06 +0300
commit20f8cabf10ff594a2b6c9dc655d63578988d4d23 (patch)
treef77a01516557a8272eb126722b2eb34fe83a1c30 /tests
parentd1d27b494dececc4e96e608d0bb47fd948d7f959 (diff)
fix: broken support for positive exponent numbers
Diffstat (limited to 'tests')
-rw-r--r--tests/MathTest.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/MathTest.php b/tests/MathTest.php
index d086acb..426e514 100644
--- a/tests/MathTest.php
+++ b/tests/MathTest.php
@@ -508,6 +508,14 @@ class MathTest extends TestCase
$this->assertEquals(1, $calculator->execute('1-0'));
}
+ public function testScientificNotation()
+ {
+ $calculator = new MathExecutor();
+ $this->assertEquals(1.5e9, $calculator->execute('1.5e9'));
+ $this->assertEquals(1.5e-9, $calculator->execute('1.5e-9'));
+ $this->assertEquals(1.5e+9, $calculator->execute('1.5e+9'));
+ }
+
public function testGetFunctionsReturnsArray()
{
$calculator = new MathExecutor();