PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 15 lines | 11 code | 4 blank | 0 comment | 1 complexity | f5b3e603bee894eeb056d03093d5027a 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/occur'
  2. require 'test/unit'
  3. class TC_Enumerable_Occur < Test::Unit::TestCase
  4. def test_occur
  5. arr = [:a,:b,:a]
  6. assert_equal( [:b], arr.occur(1) )
  7. assert_equal( [:a], arr.occur(2) )
  8. assert_equal( [:b], arr.occur(1..1) )
  9. assert_equal( [:a], arr.occur{ |n| n % 2 == 0 } )
  10. end
  11. end