all tests written.
This commit is contained in:
parent
60d096bc16
commit
96470902e2
1 changed files with 24 additions and 0 deletions
24
src/bindings/php/Tests/RightrecTest.php
Normal file
24
src/bindings/php/Tests/RightrecTest.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class RightrecTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = h_indirect();
|
||||
h_bind_indirect($this->parser, choice(sequence(ch("a"), $this->parser), h_epsilon_p()));
|
||||
}
|
||||
|
||||
public function testSuccess()
|
||||
{
|
||||
$result1 = h_parse($this->parser, "a");
|
||||
$result2 = h_parse($this->parser, "aa");
|
||||
$result3 = h_parse($this->parser, "aaa");
|
||||
$this->assertEquals(array("a"), $result1);
|
||||
$this->assertEquals(array("a", array("a")), $result2);
|
||||
$this->assertEquals(array("a", array("a", array("a"))), $result3);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue