Sha256: 364ee148c37451ca92952eb7045982ada5367a46a721f3803f28f2841bbce100

Contents?: true

Size: 436 Bytes

Versions: 4

Compression:

Stored size: 436 Bytes

Contents

covers 'facets/array/combination'

testcase Array do

  unit :combination => "finds pairs of combinations" do
    e = [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
    a = [1,2,3,4]
    r = a.combination(2).to_a
    r.assert == e
  end

  unit :combination => "can also take a block" do
    e = [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
    r = []
    a = [1,2,3,4]
    a.combination(2){ |a,b| r << [a,b] }
    r.assert == e
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.9.1 test/core/array/test_combination.rb
facets-2.9.0 test/core/array/test_combination.rb
facets-2.9.0.pre.2 test/core/array/test_combination.rb
facets-2.9.0.pre.1 test/core/array/test_combination.rb