Skip to content

Commit

Permalink
Add test cases for brackets of different types (address #13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Oct 20, 2022
1 parent b7849e2 commit c4aa144
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/muqsit/arithmexp/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,30 @@ public function testNoClosingParenthesis() : void{
TestUtil::assertParserThrows($this->parser, "x + (2 * y + (z / 2) + 5", ParseException::ERR_NO_CLOSING_PAREN, 4, 5);
}

public function testNoClosingParenthesisOfDifferingType() : void{
TestUtil::assertParserThrows($this->parser, "x + [(2 * y + z / 2) + 5", ParseException::ERR_NO_CLOSING_PAREN, 4, 5);
}

public function testUnexpectedParenthesisOfOpeningType() : void{
TestUtil::assertParserThrows($this->parser, "x + ([2 * y + z / 2) + 5", ParseException::ERR_UNEXPECTED_PAREN, 19, 20);
}

public function testNoOpeningParenthesis() : void{
TestUtil::assertParserThrows($this->parser, "x + (2 * y + z / 2)) + 5", ParseException::ERR_NO_OPENING_PAREN, 19, 20);
}

public function testNoOpeningParenthesisOfDifferingType() : void{
TestUtil::assertParserThrows($this->parser, "x + (2 * y + z / 2)] + 5", ParseException::ERR_NO_OPENING_PAREN, 19, 20);
}

public function testUnexpectedParenthesisOfClosingType() : void{
TestUtil::assertParserThrows($this->parser, "x + (2 * y + z / 2]) + 5", ParseException::ERR_UNEXPECTED_PAREN, 18, 19);
}

public function testUnexpectedParenthesisTypeInOverlap() : void{
TestUtil::assertParserThrows($this->parser, "x + (2 * y + z / [2)] + 5", ParseException::ERR_UNEXPECTED_PAREN, 19, 20);
}

public function testNoUnaryOperand() : void{
TestUtil::assertParserThrows($this->parser, "x*+", ParseException::ERR_NO_OPERAND_UNARY, 2, 3);
}
Expand Down

0 comments on commit c4aa144

Please sign in to comment.