Skip to content

Commit

Permalink
Add tests for 8194bf3 mt_rand() with different argument count
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Nov 14, 2022
1 parent 8194bf3 commit f73be61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/muqsit/arithmexp/ParserTest.php
Expand Up @@ -206,6 +206,13 @@ public function testBadFunctionCallWithArgumentOverflow() : void{
TestUtil::assertParserThrows($this->parser, "x + fn(3, 2, 1) * y", ParseException::ERR_UNRESOLVABLE_FCALL, 4, 15);
}

public function testMtRandFunctionCall() : void{
self::assertIsInt($this->parser->parse("mt_rand()")->evaluate());
TestUtil::assertParserThrows($this->parser, "mt_rand(x)", ParseException::ERR_UNRESOLVABLE_FCALL, 0, 10);
self::assertIsInt($this->parser->parse("mt_rand(1, 2)")->evaluate());
TestUtil::assertParserThrows($this->parser, "mt_rand(x, y, z)", ParseException::ERR_UNRESOLVABLE_FCALL, 0, 16);
}

public function testArgumentSeparatorOutsideFunctionCall() : void{
TestUtil::assertParserThrows($this->parser, "2 + 3 * (4, 5) / 6", ParseException::ERR_UNEXPECTED_TOKEN, 10, 11);
}
Expand Down

0 comments on commit f73be61

Please sign in to comment.