h_many1's test is failing for the same reason as h_many
This commit is contained in:
parent
e9de06636d
commit
eef5378f16
1 changed files with 31 additions and 0 deletions
31
src/bindings/php/Tests/Many1Test.php
Normal file
31
src/bindings/php/Tests/Many1Test.php
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
include_once 'hammer.php';
|
||||||
|
|
||||||
|
class Many1Test extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
protected $parser;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->parser = h_many1(choice(ch("a"), ch("b")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSuccess()
|
||||||
|
{
|
||||||
|
$result1 = h_parse($this->parser, "a");
|
||||||
|
$result2 = h_parse($this->parser, "b");
|
||||||
|
$result3 = h_parse($this->parser, "aabbaba");
|
||||||
|
$this->assertEquals(array("a"), $result1);
|
||||||
|
$this->assertEquals(array("b"), $result2);
|
||||||
|
$this->assertEquals(array("c"), $result3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFailure()
|
||||||
|
{
|
||||||
|
$result1 = h_parse($this->parser, "");
|
||||||
|
$result2 = h_parse($this->parser, "daabbabadef");
|
||||||
|
$this->assertEquals(NULL, $result1);
|
||||||
|
$this->assertEquals(NULL, $result2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue