2013-11-24 20:40:48 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
include_once 'hammer.php';
|
|
|
|
|
|
|
|
|
|
class Int8Test extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
protected $parser;
|
|
|
|
|
|
|
|
|
|
protected function setUp()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$this->parser = hammer_int8();
|
2013-11-24 20:40:48 -06:00
|
|
|
}
|
|
|
|
|
public function testSuccess()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$result = hammer_parse($this->parser, "\x88");
|
2013-11-24 20:40:48 -06:00
|
|
|
$this->assertEquals(-0x78, $result);
|
|
|
|
|
}
|
|
|
|
|
public function testFailure()
|
|
|
|
|
{
|
2013-12-18 00:32:56 +01:00
|
|
|
$result = hammer_parse($this->parser, "");
|
2013-11-24 20:40:48 -06:00
|
|
|
$this->assertEquals(NULL, $result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|