@@ -571,89 +571,4 @@ public function testIteratorWithTraversalTypes(string $traversalType, array $exp
571
571
}
572
572
$ this ->assertEquals (count ($ expected ), $ index , "Tree iteration did not visit the expected number of nodes. " );
573
573
}
574
-
575
- /**
576
- * Test: Iterating over the tree (default In-Order)
577
- */
578
- public function testIteratorInOrder (): void
579
- {
580
- $ expectedInOrder = $ this ->getExpectedInOrder ();
581
-
582
- $ expectedKeys = array_keys ($ expectedInOrder );
583
- $ expectedValues = array_values ($ expectedInOrder );
584
-
585
- $ index = 0 ;
586
-
587
- foreach ($ this ->tree as $ node ) {
588
- $ this ->assertEquals (
589
- $ expectedKeys [$ index ],
590
- $ node ->key ,
591
- "Did not match the expected inOrder key. Failed tree iteration. "
592
- );
593
- $ this ->assertEquals (
594
- $ expectedValues [$ index ],
595
- $ node ->value ,
596
- "Did not match the expected inOrder value. Failed tree iteration. "
597
- );
598
- $ index ++;
599
- }
600
- }
601
-
602
- /**
603
- * Test: Iterating over the tree with Pre-Order traversal
604
- */
605
- public function testIteratorPreOrder (): void
606
- {
607
- $ this ->tree = new BSTree ([], 'preOrder ' );
608
-
609
- $ expectedPreOrder = $ this ->getExpectedPreOrder ();
610
-
611
- $ expectedKeys = array_keys ($ expectedPreOrder );
612
- $ expectedValues = array_values ($ expectedPreOrder );
613
-
614
- $ index = 0 ;
615
-
616
- foreach ($ this ->tree as $ node ) {
617
- $ this ->assertEquals (
618
- $ expectedKeys [$ index ],
619
- $ node ->key ,
620
- "Did not match the expected preOrder key. Failed tree iteration. "
621
- );
622
- $ this ->assertEquals (
623
- $ expectedValues [$ index ],
624
- $ node ->value ,
625
- "Did not match the expected preOrder value. Failed tree iteration. "
626
- );
627
- $ index ++;
628
- }
629
- }
630
-
631
- /**
632
- * Test: Iterating over the tree with Post-Order traversal
633
- */
634
- public function testIteratorPostOrder (): void
635
- {
636
- $ this ->tree ->setTraversalType ('postOrder ' );
637
-
638
- $ expectedPostOrder = $ this ->getExpectedPostOrder ();
639
-
640
- $ expectedKeys = array_keys ($ expectedPostOrder );
641
- $ expectedValues = array_values ($ expectedPostOrder );
642
-
643
- $ index = 0 ;
644
-
645
- foreach ($ this ->tree as $ node ) {
646
- $ this ->assertEquals (
647
- $ expectedKeys [$ index ],
648
- $ node ->key ,
649
- "Did not match the expected inOrder key. Failed tree iteration. "
650
- );
651
- $ this ->assertEquals (
652
- $ expectedValues [$ index ],
653
- $ node ->value ,
654
- "Did not match the expected inOrder value. Failed tree iteration. "
655
- );
656
- $ index ++;
657
- }
658
- }
659
574
}
0 commit comments