| @@ 153-162 (lines=10) @@ | ||
| 150 | $this->assertEquals(0, $this->tree->size()); |
|
| 151 | } |
|
| 152 | ||
| 153 | public function testPreorder() { |
|
| 154 | $this->tree->put(2, "two"); |
|
| 155 | $this->tree->put(1, "one"); |
|
| 156 | $this->tree->put(3, "three"); |
|
| 157 | $this->tree->preorder(function ($node) { |
|
| 158 | // do something with the node |
|
| 159 | // echo $node->key . PHP_EOL; |
|
| 160 | }); |
|
| 161 | $this->assertTrue(true); |
|
| 162 | } |
|
| 163 | ||
| 164 | public function testInorder() { |
|
| 165 | $this->tree->put(2, "two"); |
|
| @@ 164-173 (lines=10) @@ | ||
| 161 | $this->assertTrue(true); |
|
| 162 | } |
|
| 163 | ||
| 164 | public function testInorder() { |
|
| 165 | $this->tree->put(2, "two"); |
|
| 166 | $this->tree->put(1, "one"); |
|
| 167 | $this->tree->put(3, "three"); |
|
| 168 | $this->tree->inorder(function ($node) { |
|
| 169 | // do something with the node |
|
| 170 | // echo $node->key . PHP_EOL; |
|
| 171 | }); |
|
| 172 | $this->assertTrue(true); |
|
| 173 | } |
|
| 174 | ||
| 175 | public function testPostorder() { |
|
| 176 | $this->tree->put(2, "two"); |
|
| @@ 175-184 (lines=10) @@ | ||
| 172 | $this->assertTrue(true); |
|
| 173 | } |
|
| 174 | ||
| 175 | public function testPostorder() { |
|
| 176 | $this->tree->put(2, "two"); |
|
| 177 | $this->tree->put(1, "one"); |
|
| 178 | $this->tree->put(3, "three"); |
|
| 179 | $this->tree->postorder(function ($node) { |
|
| 180 | // do something with the node |
|
| 181 | // echo $node->key . PHP_EOL; |
|
| 182 | }); |
|
| 183 | $this->assertTrue(true); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function testIsLeaf() { |
|
| 187 | $this->tree->put(2, "two"); |
|