/vendor/gems/facets-2.4.5/test/core/proc/test_curry.rb
Ruby | 25 lines | 17 code | 7 blank | 1 comment | 0 complexity | d498116bdb48232b7178cae407f60a96 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- # Test lib/more/ext/facets/proc/curry.rb
- require 'facets/proc/curry.rb'
- require 'test/unit'
- class TestProcCurry < Test::Unit::TestCase
- def test_curry_simple
- f = Proc.new{ |a,b,c| a + b + c }
- c = f.curry
- assert_equal( 6, c[1][2][3] )
- end
- def test_curry_arguments
- f = Proc.new{ |a,b| a**b }
- c = f.curry(0)
- assert_equal( 8, c[2][3] )
- f = Proc.new{ |a,b| a**b }
- c = f.curry(1)
- assert_equal( 9, c[2][3] )
- end
- end