Skip to content
Snippets Groups Projects
Commit c89f3dc7 authored by Meredith L. Patterson's avatar Meredith L. Patterson
Browse files

unsigned ints working too

parent b13d5045
No related branches found
No related tags found
No related merge requests found
<?php
include_once 'hammer.php';
class Uint16Test extends PHPUnit_Framework_TestCase
{
protected $parser;
protected function setUp()
{
$this->parser = h_uint16();
}
public function testSuccess()
{
$result = h_parse($this->parser, "\x02\x00");
$this->assertEquals(0x200, $result);
}
public function testFailure()
{
$result = h_parse($this->parser, "\x02");
$this->assertEquals(NULL, $result);
}
}
?>
\ No newline at end of file
<?php
include_once 'hammer.php';
class Uint32Test extends PHPUnit_Framework_TestCase
{
protected $parser;
protected function setUp()
{
$this->parser = h_uint32();
}
public function testSuccess()
{
$result = h_parse($this->parser, "\x00\x02\x00\x00");
$this->assertEquals(0x20000, $result);
}
public function testFailure()
{
$result = h_parse($this->parser, "\x00\x02\x00");
$this->assertEquals(NULL, $result);
}
}
?>
\ No newline at end of file
<?php
include_once 'hammer.php';
class Uint64Test extends PHPUnit_Framework_TestCase
{
protected $parser;
protected function setUp()
{
$this->parser = h_uint64();
}
public function testSuccess()
{
$result = h_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00\x00");
$this->assertEquals(0x200000000, $result);
}
public function testFailure()
{
$result = h_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00");
$this->assertEquals(NULL, $result);
}
}
?>
\ No newline at end of file
<?php
include_once 'hammer.php';
class Uint8Test extends PHPUnit_Framework_TestCase
{
protected $parser;
protected function setUp()
{
$this->parser = h_uint8();
}
public function testSuccess()
{
$result = h_parse($this->parser, "\x78");
$this->assertEquals(0x78, $result);
}
public function testFailure()
{
$result = h_parse($this->parser, "");
$this->assertEquals(NULL, $result);
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment