PHP 8.2.30
Preview: link_002.phpt Size: 675 B
//opt/cloudlinux/alt-php71/root/usr/share/pear/test/Structures_LinkedList/tests/link_002.phpt

--TEST--
link_002: Append links to an initially empty linked list
--FILE--
<?php
 
$dir = dirname(__FILE__);
require 'Structures/LinkedList/Double.php';
require 'LinkTester.php';

$xyy = new Structures_LinkedList_Double();
$xyy->appendNode($tester1);
$xyy->appendNode($tester2);
$xyy->appendNode($tester3);
$xyy->insertNode($tester4, $tester2, true);

$link = $xyy->current();
print $link->getNumb();

// test iteration with while()
while ($link = $xyy->next()) {
    print $link->getNumb();
}
$link = $xyy->rewind();
print "\n";
print $link->getNumb();
print "\n";

// test foreach() iteration
foreach ($xyy as $bull) {
  print $bull->getNumb();
}
?>
--EXPECT--
1423
1
1423

Directory Contents

Dirs: 0 × Files: 16

Name Size Perms Modified Actions
492 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
987 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
675 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1000 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
544 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1.21 KB lrw-r--r-- 2021-12-02 08:28:59
Edit Download
991 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1.32 KB lrw-r--r-- 2021-12-02 08:28:59
Edit Download
462 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1000 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
688 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1013 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
557 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1.22 KB lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1004 B lrw-r--r-- 2021-12-02 08:28:59
Edit Download
1.19 KB lrw-r--r-- 2021-12-02 08:28:59
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).