Esempio n. 1
0
 public function testFunktion()
 {
     $this->assertEquals(Callables::newFunktion(self::get1Ary()), Funktion(self::get1Ary()));
     $this->assertEquals(Callables::newFunktion(self::get2Ary()), Funktion(self::get2Ary()));
     $this->assertEquals(Callables::newFunktion(self::get3Ary()), Funktion(self::get3Ary()));
 }
Esempio n. 2
0
 public function testMap()
 {
     $functor = Funktion(function ($value) {
         return $value * 2;
     });
     $this->assertTrue(Arrays::isArray(Repeatables::map(self::getArray(), $functor)));
     $this->assertTrue(Traversables::isTraversable(Repeatables::map(self::getIterator(), $functor)));
     $this->assertTrue(Traversables::isTraversable(Repeatables::map(self::getIteratorAggregate(), $functor)));
     $repeatables = [self::getArray(), self::getIterator(), self::getIteratorAggregate()];
     foreach ($repeatables as $repeatable) {
         foreach (Repeatables::map($repeatable, $functor) as $key => $value) {
             $this->assertEquals($repeatable[$key] * 2, $value);
         }
     }
 }