Sha256: 81479b9db4d67dd0daff98e8a09711628b865c7154911036d1c56099d6d512e0

Contents?: true

Size: 576 Bytes

Versions: 35

Compression:

Stored size: 576 Bytes

Contents

require 'epitools/basetypes'
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

35 entries across 35 versions & 1 rubygems

Version Path
epitools-0.5.1 spec/permutations_spec.rb
epitools-0.5.0 spec/permutations_spec.rb
epitools-0.4.49 spec/permutations_spec.rb
epitools-0.4.48 spec/permutations_spec.rb
epitools-0.4.47 spec/permutations_spec.rb
epitools-0.4.46 spec/permutations_spec.rb
epitools-0.4.45 spec/permutations_spec.rb
epitools-0.4.44 spec/permutations_spec.rb
epitools-0.4.43 spec/permutations_spec.rb
epitools-0.4.42 spec/permutations_spec.rb
epitools-0.4.41 spec/permutations_spec.rb
epitools-0.4.40 spec/permutations_spec.rb
epitools-0.4.39 spec/permutations_spec.rb
epitools-0.4.38 spec/permutations_spec.rb
epitools-0.4.37 spec/permutations_spec.rb
epitools-0.4.36 spec/permutations_spec.rb
epitools-0.4.35 spec/permutations_spec.rb
epitools-0.4.34 spec/permutations_spec.rb
epitools-0.4.33 spec/permutations_spec.rb
epitools-0.4.32 spec/permutations_spec.rb