h_int_range works
This commit is contained in:
parent
c89f3dc7c7
commit
be08c128e0
1 changed files with 23 additions and 0 deletions
23
src/bindings/php/Tests/IntRangeTest.php
Normal file
23
src/bindings/php/Tests/IntRangeTest.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class IntRangeTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = h_int_range(h_uint8(), 3, 10);
|
||||
}
|
||||
public function testSuccess()
|
||||
{
|
||||
$result = h_parse($this->parser, "\x05");
|
||||
$this->assertEquals(5, $result);
|
||||
}
|
||||
public function testFailure()
|
||||
{
|
||||
$result = h_parse($this->parser, "\xb");
|
||||
$this->assertEquals(NULL, $result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue