PageRenderTime 53ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/more/test_thread.rb

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 22 lines | 16 code | 6 blank | 0 comment | 0 complexity | bd8f03e25d6aa59fc3f4def24896f57c MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/thread.rb'
  2. require 'test/unit'
  3. class TC_Thread < Test::Unit::TestCase
  4. def test_threaded_map
  5. r = [1,2,3].threaded_map{ |e| e + 1 }
  6. assert_equal([2,3,4], r)
  7. end
  8. def test_threaded_map_send
  9. r = [1,2,3].threaded_map_send(:+, 1)
  10. assert_equal([2,3,4], r)
  11. end
  12. def test_map_send_with_block
  13. r = [[1,2,3],[2,3,4],[3,4,5]].threaded_map_send(:select){ |x| x > 2 }
  14. assert_equal([[3],[3,4],[3,4,5]], r)
  15. end
  16. end