diff --git a/tests/DataStructures/BSTreeTest.php b/tests/DataStructures/BSTreeTest.php index 2f592ae..efdb79f 100644 --- a/tests/DataStructures/BSTreeTest.php +++ b/tests/DataStructures/BSTreeTest.php @@ -571,89 +571,4 @@ public function testIteratorWithTraversalTypes(string $traversalType, array $exp } $this->assertEquals(count($expected), $index, "Tree iteration did not visit the expected number of nodes."); } - - /** - * Test: Iterating over the tree (default In-Order) - */ - public function testIteratorInOrder(): void - { - $expectedInOrder = $this->getExpectedInOrder(); - - $expectedKeys = array_keys($expectedInOrder); - $expectedValues = array_values($expectedInOrder); - - $index = 0; - - foreach ($this->tree as $node) { - $this->assertEquals( - $expectedKeys[$index], - $node->key, - "Did not match the expected inOrder key. Failed tree iteration." - ); - $this->assertEquals( - $expectedValues[$index], - $node->value, - "Did not match the expected inOrder value. Failed tree iteration." - ); - $index++; - } - } - - /** - * Test: Iterating over the tree with Pre-Order traversal - */ - public function testIteratorPreOrder(): void - { - $this->tree = new BSTree([], 'preOrder'); - - $expectedPreOrder = $this->getExpectedPreOrder(); - - $expectedKeys = array_keys($expectedPreOrder); - $expectedValues = array_values($expectedPreOrder); - - $index = 0; - - foreach ($this->tree as $node) { - $this->assertEquals( - $expectedKeys[$index], - $node->key, - "Did not match the expected preOrder key. Failed tree iteration." - ); - $this->assertEquals( - $expectedValues[$index], - $node->value, - "Did not match the expected preOrder value. Failed tree iteration." - ); - $index++; - } - } - - /** - * Test: Iterating over the tree with Post-Order traversal - */ - public function testIteratorPostOrder(): void - { - $this->tree->setTraversalType('postOrder'); - - $expectedPostOrder = $this->getExpectedPostOrder(); - - $expectedKeys = array_keys($expectedPostOrder); - $expectedValues = array_values($expectedPostOrder); - - $index = 0; - - foreach ($this->tree as $node) { - $this->assertEquals( - $expectedKeys[$index], - $node->key, - "Did not match the expected inOrder key. Failed tree iteration." - ); - $this->assertEquals( - $expectedValues[$index], - $node->value, - "Did not match the expected inOrder value. Failed tree iteration." - ); - $index++; - } - } }