Sha256: 5b5ca4a5c5a702d38ca766d3037e2df4e3b17ce3d8219e3488f4eac0c2469ada

Contents?: true

Size: 628 Bytes

Versions: 88

Compression:

Stored size: 628 Bytes

Contents

#require 'epitools/core_ext'
#require 'epitools/permutations'
require 'epitools'
require 'epitools/permutations'

describe "Permutations" do
  
  it "a*b" do
    ([1,2] * [3,4]).should == [ [1,3], [1,4], [2,3], [2,4] ]
  end    

  it "a**2" do
    ([1,2] ** 2).should == [ [1,1], [1,2], [2,1], [2,2] ]
  end    
  
  it "all_pairses" do
    [1,2,3,4].all_pairs.to_a.should == [ 
      [1,2], 
      [1,3], 
      [1,4], 
      [2,3],
      [2,4],
      [3,4],
    ]

    # reflexive    
    [1,2,3].all_pairs(true).to_a.should == [
      [1,1],
      [1,2],
      [1,3],
      [2,2],
      [2,3],
      [3,3],
    ]
  end

end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
epitools-0.5.103 spec/permutations_spec.rb
epitools-0.5.100 spec/permutations_spec.rb
epitools-0.5.99 spec/permutations_spec.rb
epitools-0.5.98 spec/permutations_spec.rb
epitools-0.5.97 spec/permutations_spec.rb
epitools-0.5.96 spec/permutations_spec.rb
epitools-0.5.95 spec/permutations_spec.rb
epitools-0.5.94 spec/permutations_spec.rb
epitools-0.5.93 spec/permutations_spec.rb
epitools-0.5.92 spec/permutations_spec.rb
epitools-0.5.91 spec/permutations_spec.rb
epitools-0.5.90 spec/permutations_spec.rb
epitools-0.5.89 spec/permutations_spec.rb
epitools-0.5.88 spec/permutations_spec.rb
epitools-0.5.87 spec/permutations_spec.rb
epitools-0.5.86 spec/permutations_spec.rb
epitools-0.5.85 spec/permutations_spec.rb
epitools-0.5.84 spec/permutations_spec.rb
epitools-0.5.83 spec/permutations_spec.rb
epitools-0.5.82 spec/permutations_spec.rb