/** @covers YaLinqo\Enumerable::returnEnum */ function testReturnEnum() { $this->assertEnumEquals([1], E::returnEnum(1)); $this->assertEnumEquals([true], E::returnEnum(true)); $this->assertEnumEquals([null], E::returnEnum(null)); }
/** @covers YaLinqo\Enumerable::returnEnum */ function testReturnEnum() { $this->assertEnumEquals(array(1), E::returnEnum(1)); $this->assertEnumEquals(array(true), E::returnEnum(true)); $this->assertEnumEquals(array(null), E::returnEnum(null)); }
return $v * $v; })); var_dump(from(array(1, 2, 3))->min()); var_dump($enum->min()); //var_dump(from(new \EmptyIterator)->min()); var_dump($enum->maxBy(__NAMESPACE__ . '\\compare_strlen', function ($v, $k) { return $v . ' ' . $k; })); var_dump($enum->toArray()); var_dump($enum->toValues()->toArray()); var_dump($enum->toValues()->elementAt(2)); var_dump($enum->toValues()->elementAtOrDefault(-1, 666)); //var_dump(from(array(1, 2, 3))->take(2)->toArray()); var_dump(Enumerable::cycle(array(1, 2, 3))->take(10)->toArray()); var_dump(Enumerable::emptyEnum()->toArray()); var_dump(Enumerable::returnEnum('a')->toArray()); //var_dump(Enumerable::repeat('b', -1)->toArray()); var_dump(Enumerable::repeat('c', 0)->toArray()); var_dump(Enumerable::repeat('d', 2)->toArray()); var_dump(Enumerable::repeat('e', INF)->take(2)->toArray()); var_dump(Enumerable::generate(function ($v, $k) { return $k * $k - $v * 2; })->take(20)->toArray()); var_dump(Enumerable::generate(function ($v, $k) { return $v + $k; }, 1, function ($v) { return $v; }, 1)->take(10)->toArray()); var_dump(Enumerable::generate(function ($v) { return array($v[1], $v[0] + $v[1]); }, array(1, 1), function ($v) {