Sha256: f19fee424b3c8e8967ba029c4c018a68d27a8ec52c979c59923f71be83f3fa48

Contents?: true

Size: 820 Bytes

Versions: 10

Compression:

Stored size: 820 Bytes

Contents

  #  _____         _
  # |_   _|__  ___| |_
  #   | |/ _ \/ __| __|
  #   | |  __/\__ \ |
  #   |_|\___||___/\__|
  #
  # for lib/facets/proc/compose.rb
  #
  # Extracted Mon Sep 03 16:23:07 -0700 2007
  # w/ Test Extraction Ratchet
  #

 require 'facets/proc/compose.rb'



  require 'test/unit'

  class TestProc < Test::Unit::TestCase

    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

    def test_times_collect_op
      a = lambda { |x| x + 4 }
      assert_equal( [4,5,6], a * 3 )
    end

    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

  end



Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.0.0 test/unit/proc/test_compose.rb
facets-2.0.1 test/unit/proc/test_compose.rb
facets-2.0.2 test/unit/proc/test_compose.rb
facets-2.0.3 test/unit/proc/test_compose.rb
facets-2.0.4 test/unit/proc/test_compose.rb
facets-2.0.5 test/unit/proc/test_compose.rb
facets-2.1.0 test/unit/proc/test_compose.rb
facets-2.1.1 test/unit/proc/test_compose.rb
facets-2.1.2 test/unit/proc/test_compose.rb
facets-2.1.3 test/unit/proc/test_compose.rb