/vendor/gems/facets-2.4.5/test/core/array/test_permutation.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 14 lines · 11 code · 3 blank · 0 comment · 0 complexity · 37b271df53392e7faea47100232eb664 MD5 · raw file

  1. require 'facets/array/permutation'
  2. require 'test/unit'
  3. require 'set'
  4. class TestEnumerablePermutation < Test::Unit::TestCase
  5. def test_permutation
  6. o = Set.new
  7. %w[a b c].permutation{ |x| o << x.join('') }
  8. r = Set.new(['abc','acb','bac','bca','cab','cba'])
  9. assert_equal( r, o )
  10. end
  11. end