From 596d619fb5b02e027c1682031c40e9c55e894ab9 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Sat, 30 Nov 2013 16:54:26 -0800 Subject: [PATCH] h_left works --- src/bindings/php/Tests/LeftTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/bindings/php/Tests/LeftTest.php diff --git a/src/bindings/php/Tests/LeftTest.php b/src/bindings/php/Tests/LeftTest.php new file mode 100644 index 00000000..4f50e0e7 --- /dev/null +++ b/src/bindings/php/Tests/LeftTest.php @@ -0,0 +1,28 @@ +<?php +include_once 'hammer.php'; + +class LeftTest extends PHPUnit_Framework_TestCase +{ + protected $parser; + + protected function setUp() + { + $this->parser = h_left(h_ch("a"), h_ch(" ")); + } + public function testSuccess() + { + $result = h_parse($this->parser, "a "); + // TODO fix these tests when h_ch is fixed + $this->assertEquals(97, $result); + } + public function testFailure() + { + $result1 = h_parse($this->parser, "a"); + $result2 = h_parse($this->parser, " "); + $result3 = h_parse($this->parser, "ab"); + $this->assertEquals(NULL, $result1); + $this->assertEquals(NULL, $result2); + $this->assertEquals(NULL, $result3); + } +} +?> \ No newline at end of file -- GitLab