From a10572e7510310add05c764a838ea2f4991aa06b Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Sun, 1 Dec 2013 21:25:28 -0800 Subject: [PATCH] AFAIK h_xor just needs h_ch_range working correctly --- src/bindings/php/Tests/XorTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/bindings/php/Tests/XorTest.php diff --git a/src/bindings/php/Tests/XorTest.php b/src/bindings/php/Tests/XorTest.php new file mode 100644 index 00000000..67e8bf31 --- /dev/null +++ b/src/bindings/php/Tests/XorTest.php @@ -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); + } +} +?> \ No newline at end of file -- GitLab