Compare commits

...

4 Commits

Author SHA1 Message Date
Denis Knauf ede467e934 „README.md“ ändern 2021-12-03 18:40:08 +01:00
Denis Knauf 145129641d v0.1.5 2011-12-16 12:45:52 +01:00
Denis Knauf 99a268a89d more tests 2011-12-16 12:45:22 +01:00
Denis Knauf c8edcddcf6 tests added 2011-12-16 11:42:45 +01:00
4 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Obsolete
========
Use `#lazy`.
Install
=======

View File

@ -1 +1 @@
0.1.4
0.1.5

View File

@ -47,7 +47,7 @@ class Counter
end
class Functional
def self.__version__() '0.1.4' end
def self.__version__() '0.1.5' end
include Enumerable
class DEFAULT

29
test/functional_test.rb Normal file
View File

@ -0,0 +1,29 @@
require 'test/unit'
require 'functional'
class FunTest < Test::Unit::TestCase
M = 0..100
def doit_fun m, &exe
f = m.to_fun
yield f
f.to_a
end
def test_to_fun_exists
assert_respond_to Object, :to_fun
end
def test_to_a
assert_equal M.to_a, doit_fun( M) {|x| x }
end
def test_collect
l = lambda {|x| x*2}
assert_equal M.collect( &l), doit_fun( M) {|x| x.collect( &l) }
end
def test_inject
assert_equal M.inject( 0) {|i,j| i+j }, M.to_fun.inject( 0) {|i,j| i+j }
end
end