File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1111use function Cdn77 \Functions \mapFromIterable ;
1212use function Cdn77 \Functions \mappedValueSetsFromIterable ;
1313use function Cdn77 \Functions \setFromIterable ;
14+ use function Cdn77 \Functions \vectorFromIterable ;
1415
1516final class DsTest extends TestCase
1617{
@@ -64,4 +65,19 @@ public function testSetFromIterable() : void
6465 self ::assertCount (2 , $ set );
6566 self ::assertTrue ($ set ->contains (true , false ));
6667 }
68+
69+ public function testVectorFromIterable () : void
70+ {
71+ /** @var callable():Generator<int, bool> $iterableFactory */
72+ $ iterableFactory = static function () : Generator {
73+ yield 1 => true ;
74+ yield 2 => false ;
75+ yield 2 => true ;
76+ };
77+
78+ $ vector = vectorFromIterable ($ iterableFactory (), static fn (int $ _ , bool $ value ) => ! $ value );
79+
80+ self ::assertCount (3 , $ vector );
81+ self ::assertSame ([false , true , false ], $ vector ->toArray ());
82+ }
6783}
You can’t perform that action at this time.
0 commit comments