芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/rentandbuyrealty.com/pay/vendor/hoa/iterator/Test/Unit/Demultiplexer.php
given( $counter = new LUT\Counter(0, 10, 1), $multiple = new LUT\Multiple(), $multiple->attachIterator($counter), $multiple->attachIterator(clone $counter), $demultiplexer = new LUT\Demultiplexer( $multiple, function ($current) { return $current[0] * $current[1]; } ) ) ->when($result = iterator_to_array($demultiplexer, false)) ->then ->array($result) ->isEqualTo([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 ]); } public function case_associative_keys() { $this ->given( $counter = new LUT\Counter(0, 10, 1), $multiple = new LUT\Multiple( LUT\Multiple::MIT_NEED_ANY | LUT\Multiple::MIT_KEYS_ASSOC ), $multiple->attachIterator($counter, 'one'), $multiple->attachIterator(clone $counter, 'two'), $demultiplexer = new LUT\Demultiplexer( $multiple, function ($current) { return $current['one'] * $current['two']; } ) ) ->when($result = iterator_to_array($demultiplexer, false)) ->then ->array($result) ->isEqualTo([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 ]); } }