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

Language Ruby Lines 23
MD5 Hash bd8f03e25d6aa59fc3f4def24896f57c Estimated Cost $352 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
require 'facets/thread.rb'
require 'test/unit'

class TC_Thread < Test::Unit::TestCase

  def test_threaded_map
    r = [1,2,3].threaded_map{ |e| e + 1 }
    assert_equal([2,3,4], r)
  end

  def test_threaded_map_send
    r = [1,2,3].threaded_map_send(:+, 1)
    assert_equal([2,3,4], r)
  end

  def test_map_send_with_block
    r = [[1,2,3],[2,3,4],[3,4,5]].threaded_map_send(:select){ |x| x > 2 }
    assert_equal([[3],[3,4],[3,4,5]], r)
  end

end
Back to Top