2013-11-20 02:13:41 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require("hammer.php");
|
|
|
|
|
|
|
|
|
|
class TestHammer extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
protected $parser;
|
|
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
|
{
|
|
|
|
|
$this->parser = hammer::h_token("95\xa2", 3);
|
|
|
|
|
}
|
|
|
|
|
public function testSuccess()
|
|
|
|
|
{
|
|
|
|
|
$result = hammer::h_parse($this->parser, "95\xa2", 3);
|
2013-11-20 17:36:15 -06:00
|
|
|
var_dump($result);
|
|
|
|
|
$this->assertEquals($result->__get("ast")->__get("token_data")->__get("bytes"), "95\xa2");
|
2013-11-20 02:13:41 -06:00
|
|
|
}
|
|
|
|
|
public function testFailure()
|
|
|
|
|
{
|
|
|
|
|
$result = hammer::h_parse($this->parser, "95", 2);
|
|
|
|
|
$this->assertEquals($result, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|