PageRenderTime 84ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/core/enumerable/test_commonality.rb

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 15 lines | 12 code | 3 blank | 0 comment | 0 complexity | 93b36d821b63a671883b8e52cef0e4b8 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/enumerable/commonality.rb'
  2. require 'test/unit'
  3. class Test_Enumerable_Commonality < Test::Unit::TestCase
  4. def test_commonality
  5. a = [1,2,2,3,3,3]
  6. r = { 2 => [2,2], 3 => [3,3,3] }
  7. assert_equal( r, a.commonality )
  8. a = [1,2,2,3,3,3]
  9. r = {false=>[1, 2, 2], true=>[3, 3, 3]}
  10. assert_equal( r, a.commonality { |x| x > 2 } )
  11. end
  12. end