functional 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -47,7 +47,7 @@ class Counter
47
47
  end
48
48
 
49
49
  class Functional
50
- def self.__version__() '0.1.4' end
50
+ def self.__version__() '0.1.5' end
51
51
  include Enumerable
52
52
 
53
53
  class DEFAULT
@@ -0,0 +1,29 @@
1
+ require 'test/unit'
2
+ require 'functional'
3
+
4
+ class FunTest < Test::Unit::TestCase
5
+ M = 0..100
6
+
7
+ def doit_fun m, &exe
8
+ f = m.to_fun
9
+ yield f
10
+ f.to_a
11
+ end
12
+
13
+ def test_to_fun_exists
14
+ assert_respond_to Object, :to_fun
15
+ end
16
+
17
+ def test_to_a
18
+ assert_equal M.to_a, doit_fun( M) {|x| x }
19
+ end
20
+
21
+ def test_collect
22
+ l = lambda {|x| x*2}
23
+ assert_equal M.collect( &l), doit_fun( M) {|x| x.collect( &l) }
24
+ end
25
+
26
+ def test_inject
27
+ assert_equal M.inject( 0) {|i,j| i+j }, M.to_fun.inject( 0) {|i,j| i+j }
28
+ end
29
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Denis Knauf
@@ -32,6 +32,7 @@ files:
32
32
  - README.md
33
33
  - VERSION
34
34
  - lib/functional.rb
35
+ - test/functional_test.rb
35
36
  - LICENSE
36
37
  has_rdoc: true
37
38
  homepage: http://github.com/DenisKnauf/functional