2013-12-01 22:09:45 -08:00
|
|
|
<?php
|
|
|
|
|
include_once 'hammer.php';
|
|
|
|
|
|
|
|
|
|
class LeftrecTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
protected $parser;
|
|
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$this->parser = hammer_indirect();
|
|
|
|
|
hammer_bind_indirect($this->parser, hammer_choice(hammer_sequence($this->parser, hammer_ch("a")), hammer_ch("a")));
|
2013-12-01 22:09:45 -08:00
|
|
|
}
|
|
|
|
|
|
2013-12-10 00:53:35 +01:00
|
|
|
public function testSuccess1()
|
2013-12-01 22:09:45 -08:00
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$result = hammer_parse($this->parser, "a");
|
2013-12-10 00:53:35 +01:00
|
|
|
$this->assertEquals("a", $result);
|
|
|
|
|
}
|
2013-12-16 13:21:27 +01:00
|
|
|
/* These don't work in the underlying C so they won't work here either */
|
|
|
|
|
/*
|
2013-12-10 00:53:35 +01:00
|
|
|
public function testSuccess2()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$result = hammer_parse($this->parser, "aa");
|
2013-12-10 00:53:35 +01:00
|
|
|
var_dump($result);
|
2013-12-01 22:09:45 -08:00
|
|
|
$this->assertEquals(array("a", "a"), $result);
|
2013-12-10 00:53:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSuccess3()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$result = hammer_parse($this->parser, "aaa");
|
2013-12-10 00:53:35 +01:00
|
|
|
var_dump($result);
|
2013-12-01 22:09:45 -08:00
|
|
|
$this->assertEquals(array(array("a", "a"), "a"), $result);
|
|
|
|
|
}
|
2013-12-16 13:21:27 +01:00
|
|
|
*/
|
2013-12-01 22:09:45 -08:00
|
|
|
}
|
|
|
|
|
?>
|