Sha256: ab63b610e8b173fbf46956ba5364408c94ce83f90ffc347b5ae2a33d2c0d873a
Contents?: true
Size: 821 Bytes
Versions: 1
Compression:
Stored size: 821 Bytes
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facet/functor.rb # # Extracted Wed Jan 25 10:52:51 EST 2006 # Unit Tools Reap Test Extractor # require 'facet/functor.rb' require 'test/unit' class TC_Functor < Test::Unit::TestCase def test_function f = Functor.new { |op, x| x.send(op, x) } assert_equal( 2, f + 1 ) #=> 2 assert_equal( 4, f + 2 ) #=> 4 assert_equal( 6, f + 3 ) #=> 6 assert_equal( 1, f * 1 ) #=> 1 assert_equal( 4, f * 2 ) #=> 4 assert_equal( 9, f * 3 ) #=> 9 end def test_decoration f = Functor.new("A") { |op, a, x| x.send(op, a + x) } assert_equal( 'BAB', f + 'B' ) assert_equal( 'CAC', f + 'C' ) assert_equal( 'DAD', f + 'D' ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-1.0.3 | packages/more/test/lib/facet/test_functor.rb |