Skip to content

Commit

Permalink
#812 - Add more test cases for negative and positive long/int values
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Apr 7, 2021
1 parent c7f4aec commit 9d2c34f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion stub/arithmetic.zep
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,17 @@ class Arithmetic
/**
* @issue https://github.com/zephir-lang/zephir/issues/812
*/
public function absParam(const uint! val)
public function absParam(const uint! val) -> uint
{
return val;
}

public function negativeInt(const int val) -> int
{
return val;
}

public function negativeLong(const long val) -> long
{
return val;
}
Expand Down
9 changes: 9 additions & 0 deletions tests/Extension/ArithmeticTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,14 @@ public function testIssue812(): void
{
$this->assertSame(1, $this->class->absParam(1));
$this->assertSame(1, $this->class->absParam(-1));
$this->assertSame(1234567, $this->class->absParam(-1234567));

$this->assertSame(-1, $this->class->negativeInt(-1));
$this->assertSame(-1234567, $this->class->negativeInt(-1234567));
$this->assertSame(1234567, $this->class->negativeInt(1234567));

$this->assertSame(-1, $this->class->negativeLong(-1));
$this->assertSame(-1234567, $this->class->negativeLong(-1234567));
$this->assertSame(1234567, $this->class->negativeLong(1234567));
}
}

0 comments on commit 9d2c34f

Please sign in to comment.