Sha256: 1873c36ed8e46a890a2af62c7e220d13044a2369175b14c1c5972a17f9d2f1d2

Contents?: true

Size: 612 Bytes

Versions: 38

Compression:

Stored size: 612 Bytes

Contents

require 'rspec'
require 'abstractivator/collections'

describe Abstractivator::Collections do

  include Abstractivator::Collections

  describe '#multizip' do
    it 'transposes' do
      xs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
      expect(multizip(xs)).to eql [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
      expect(multizip([])).to eql []
    end
    it 'uses a default value past the end of shorter enumerables' do
      xs = [[1, 2, 3], [4], [7, 8, 9]]
      expect(multizip(xs)).to eql [[1, 4, 7], [2, nil, 8], [3, nil, 9]]
      expect(multizip(xs, -1)).to eql [[1, 4, 7], [2, -1, 8], [3, -1, 9]]
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
abstractivator-0.20.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.19.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.18.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.17.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.16.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.15.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.14.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.13.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.12.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.11.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.10.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.8.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.7.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.6.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.5.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.4.1 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.4.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.3.1 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.3.0 spec/lib/abstractivator/collections_spec.rb
abstractivator-0.2.0 spec/lib/abstractivator/collections_spec.rb