public function testIteratorInterface()
{
$set = new Set([1, 2, 3, 4, 5]);
$i = 1;
foreach ($set as $key => $value) {
$this->assertEquals($i, $key);
$this->assertEquals($i, $value);
$i++;
}
$set = new Set([new Set([1, 2]), new Set([3, 4])]);
$i = 1;
foreach ($set as $key => $value) {
if ($i === 1) {
$this->assertEquals('Set{1, 2}', $key);
$this->assertEquals(new Set([1, 2]), $value);
}
if ($i === 2) {
$this->assertEquals('Set{3, 4}', $key);
$this->assertEquals(new Set([3, 4]), $value);
}
$i++;
}
}