AFAIK h_xor just needs h_ch_range working correctly
This commit is contained in:
parent
0c9ab03fd7
commit
a10572e751
1 changed files with 29 additions and 0 deletions
29
src/bindings/php/Tests/XorTest.php
Normal file
29
src/bindings/php/Tests/XorTest.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
include_once 'hammer.php';
|
||||||
|
|
||||||
|
class XorTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
protected $parser;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->parser = h_xor(h_ch_range("0", "6"), h_ch_range("5", "9"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSuccess()
|
||||||
|
{
|
||||||
|
$result1 = h_parse($this->parser, "0");
|
||||||
|
$result2 = h_parse($this->parser, "9");
|
||||||
|
$this->assertEquals("0", $result1);
|
||||||
|
$this->assertEquals("9", $result2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFailure()
|
||||||
|
{
|
||||||
|
$result1 = h_parse($this->parser, "5");
|
||||||
|
$result2 = h_parse($this->parser, "a");
|
||||||
|
$this->assertEquals(NULL, $result1);
|
||||||
|
$this->assertEquals(NULL, $result2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue