diff --git a/src/bindings/php/Tests/Uint16Test.php b/src/bindings/php/Tests/Uint16Test.php new file mode 100644 index 0000000..4639389 --- /dev/null +++ b/src/bindings/php/Tests/Uint16Test.php @@ -0,0 +1,24 @@ +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 diff --git a/src/bindings/php/Tests/Uint32Test.php b/src/bindings/php/Tests/Uint32Test.php new file mode 100644 index 0000000..f9b0f0b --- /dev/null +++ b/src/bindings/php/Tests/Uint32Test.php @@ -0,0 +1,24 @@ +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 diff --git a/src/bindings/php/Tests/Uint64Test.php b/src/bindings/php/Tests/Uint64Test.php new file mode 100644 index 0000000..9910916 --- /dev/null +++ b/src/bindings/php/Tests/Uint64Test.php @@ -0,0 +1,24 @@ +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 diff --git a/src/bindings/php/Tests/Uint8Test.php b/src/bindings/php/Tests/Uint8Test.php new file mode 100644 index 0000000..6797949 --- /dev/null +++ b/src/bindings/php/Tests/Uint8Test.php @@ -0,0 +1,24 @@ +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