2013-11-30 17:18:58 -08:00
|
|
|
<?php
|
|
|
|
|
include_once 'hammer.php';
|
|
|
|
|
|
|
|
|
|
class EndPTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
protected $parser;
|
|
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
|
{
|
2013-12-01 16:07:25 -08:00
|
|
|
$this->parser = sequence(ch("a"), h_end_p());
|
2013-11-30 17:18:58 -08:00
|
|
|
}
|
2013-12-01 16:07:25 -08:00
|
|
|
|
2013-11-30 17:18:58 -08:00
|
|
|
public function testSuccess()
|
|
|
|
|
{
|
2013-12-01 21:04:54 -08:00
|
|
|
$result = h_parse($this->parser, "a");
|
2013-12-01 20:55:04 -08:00
|
|
|
var_dump($result);
|
2013-12-01 21:04:54 -08:00
|
|
|
$this->assertEquals(array("a"), $result);
|
2013-11-30 17:18:58 -08:00
|
|
|
}
|
|
|
|
|
public function testFailure()
|
|
|
|
|
{
|
|
|
|
|
$result = h_parse($this->parser, "aa");
|
2013-12-01 20:55:04 -08:00
|
|
|
var_dump($result);
|
2013-12-01 21:04:54 -08:00
|
|
|
$this->assertEquals(array(), $result);
|
2013-11-30 17:18:58 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|