public function testForeach() { $m = [1, 2, 3]; $i = 1; $mm = [$m]; $x2 = function ($a) { return [$a * 2]; }; $mm2 = [bind($m, $x2)]; $mm = mplus($mm, $mm2); $i = 1; $j = 1; foreach ($mm as $vv) { $i = $j; foreach ($vv as $v) { $this->assertEquals($i, $v); $i += $j; } $j++; } $this->assertEquals(8, $i); $this->assertEquals(3, $j); }
public function testTreeArray() { $ret = $this->runSearch(); $this->assertEquals([3, 1], mplus($ret, [])); }