/vendor/gems/facets-2.4.5/test/core/proc/test_curry.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 25 lines · 17 code · 7 blank · 1 comment · 0 complexity · d498116bdb48232b7178cae407f60a96 MD5 · raw file

  1. # Test lib/more/ext/facets/proc/curry.rb
  2. require 'facets/proc/curry.rb'
  3. require 'test/unit'
  4. class TestProcCurry < Test::Unit::TestCase
  5. def test_curry_simple
  6. f = Proc.new{ |a,b,c| a + b + c }
  7. c = f.curry
  8. assert_equal( 6, c[1][2][3] )
  9. end
  10. def test_curry_arguments
  11. f = Proc.new{ |a,b| a**b }
  12. c = f.curry(0)
  13. assert_equal( 8, c[2][3] )
  14. f = Proc.new{ |a,b| a**b }
  15. c = f.curry(1)
  16. assert_equal( 9, c[2][3] )
  17. end
  18. end