Sha256: 092424dc5f6a213d2d8a67ce8c2571858d67227c19a94565177c5044973a0b94

Contents?: true

Size: 438 Bytes

Versions: 16

Compression:

Stored size: 438 Bytes

Contents

require 'facets/proc/compose.rb'
require 'test/unit'

class TestProc < Test::Unit::TestCase

  def test_compose
    a = lambda { |x| x + 4 }
    b = lambda { |y| y / 2 }
    assert_equal( 6, (a.compose(b)).call(4) )
    assert_equal( 4, (b.compose(a)).call(4) )
  end

  def test_compose_op
    a = lambda { |x| x + 4 }
    b = lambda { |y| y / 2 }
    assert_equal( 6, (a * b).call(4) )
    assert_equal( 4, (b * a).call(4) )
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/proc/test_compose.rb
facets-2.8.3 test/core/proc/test_compose.rb
facets-2.8.2 test/core/proc/test_compose.rb
facets-2.8.1 test/core/proc/test_compose.rb
facets-2.8.0 test/core/proc/test_compose.rb
facets-2.7.0 test/core/proc/test_compose.rb
facets-2.6.0 test/core/proc/test_compose.rb
facets-2.4.0 test/proc/test_compose.rb
facets-2.4.1 test/proc/test_compose.rb
facets-2.4.2 test/core/proc/test_compose.rb
facets-2.4.3 test/core/proc/test_compose.rb
facets-2.4.4 test/core/proc/test_compose.rb
facets-2.5.1 test/core/proc/test_compose.rb
facets-2.5.0 test/core/proc/test_compose.rb
facets-2.4.5 test/core/proc/test_compose.rb
facets-2.5.2 test/core/proc/test_compose.rb