paramix 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,55 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Nested_Bottom < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
- public :f do
13
- params[:p]
14
- end
15
- end
16
- end
17
-
18
- module N
19
- include M
20
-
21
- parameterized do |params|
22
- public :g do
23
- params[:p]
24
- end
25
- end
26
- end
27
-
28
- class I
29
- include N[:p => "INp"]
30
- end
31
-
32
- class E
33
- extend N[:p => "ENp"]
34
- end
35
-
36
- # -- tests --------------------------------
37
-
38
- def test_include_f
39
- assert_equal( "INp", I.new.f )
40
- end
41
-
42
- def test_include_g
43
- assert_equal( "INp", I.new.g )
44
- end
45
-
46
- def test_extend_f
47
- assert_equal( "ENp", E.f )
48
- end
49
-
50
- def test_extend_g
51
- assert_equal( "ENp", E.g )
52
- end
53
-
54
- end
55
-
@@ -1,48 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Nested_Simple < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
- public :f do
13
- params[:p]
14
- end
15
- end
16
- end
17
-
18
- module N
19
- include Paramix::Parametric
20
- include M[:p=>"NMp"]
21
- end
22
-
23
- class I ; include N[] ; end
24
- class E ; extend N[] ; end
25
-
26
- class Ix ; include N[:p=>"IxNp"] ; end
27
- class Ex ; extend N[:p=>"ExNp"] ; end
28
-
29
- # -- tests --------------------------------
30
-
31
- def test_include_if
32
- assert_equal( "NMp", I.new.f )
33
- end
34
-
35
- def test_extend_ef
36
- assert_equal( "NMp", E.f )
37
- end
38
-
39
- def test_include_ixf
40
- assert_equal( "NMp", I.new.f )
41
- end
42
-
43
- def test_extend_exf
44
- assert_equal( "NMp", E.f )
45
- end
46
-
47
- end
48
-
@@ -1,41 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Nested_Simple < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
- public :f do
13
- params[:p]
14
- end
15
- end
16
- end
17
-
18
- module N
19
- include M[:p=>"NMp"]
20
- end
21
-
22
- class I
23
- include N
24
- end
25
-
26
- class E
27
- extend N
28
- end
29
-
30
- # -- tests --------------------------------
31
-
32
- def test_include_if
33
- assert_equal( "NMp", I.new.f )
34
- end
35
-
36
- def test_extend_ef
37
- assert_equal( "NMp", E.f )
38
- end
39
-
40
- end
41
-
@@ -1,56 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Nested_Top < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
- public :f do
13
- params[:p]
14
- end
15
- end
16
- end
17
-
18
- module N
19
- include Paramix::Parametric
20
- include M[:p=>"mood"]
21
-
22
- parameterized do |params|
23
- public :g do
24
- params[:p]
25
- end
26
- end
27
- end
28
-
29
- class I
30
- include N[]
31
- end
32
-
33
- class E
34
- extend N[]
35
- end
36
-
37
- # -- tests --------------------------------
38
-
39
- def test_include_f
40
- assert_equal( "mood", I.new.f )
41
- end
42
-
43
- def test_include_g
44
- assert_equal( nil, I.new.g ) # TODO: or error ?
45
- end
46
-
47
- def test_extend_f
48
- assert_equal( "mood", E.f )
49
- end
50
-
51
- def test_extend_g
52
- assert_equal( nil, E.g )
53
- end
54
-
55
- end
56
-
@@ -1,66 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- include Paramix
5
-
6
- class TC_Paramix_Callback < Test::Unit::TestCase
7
-
8
- # -- fixture ------------------------------
9
-
10
- module M
11
- include Parametric
12
-
13
- parameterized do |params|
14
-
15
- public :f do
16
- params[:p]
17
- end
18
-
19
- attr_accessor params[:p]
20
- end
21
-
22
- #
23
- #def self.included(base)
24
- # base.class_eval do
25
- # attr_accessor mixin_parameters[M][:p]
26
- # end
27
- # super(base)
28
- #end
29
- end
30
-
31
- class C1
32
- include M[:p => "c1"]
33
- end
34
-
35
- class C2
36
- include M[:p => "c2"]
37
- end
38
-
39
- # -- tests --------------------------------
40
-
41
- def test_class_1
42
- c = C1.new
43
- #assert_equal( "c1", c.mixin_params[:p] )
44
- assert_equal( "c1", c.f )
45
- end
46
-
47
- def test_class_2
48
- c = C2.new
49
- #assert_equal( "c2", c.mixin_params[:p] )
50
- assert_equal( "c2", c.f )
51
- end
52
-
53
- def test_callback_class_1
54
- c = C1.new
55
- c.c1 = :yes1
56
- assert_equal(:yes1, c.c1)
57
- end
58
-
59
- def test_callback_class_2
60
- c = C2.new
61
- c.c2 = :yes2
62
- assert_equal(:yes2, c.c2)
63
- end
64
-
65
- end
66
-
@@ -1,39 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Extend < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
-
13
- public :f do
14
- params[:p]
15
- end
16
-
17
- end
18
- end
19
-
20
- class C1
21
- extend M[:p => "mosh"]
22
- end
23
-
24
- class C2
25
- extend M[:p => "many"]
26
- end
27
-
28
- # -- tests --------------------------------
29
-
30
- def test_class_1
31
- assert_equal( "mosh", C1.f )
32
- end
33
-
34
- def test_class_2
35
- assert_equal( "many", C2.f )
36
- end
37
-
38
- end
39
-
@@ -1,39 +0,0 @@
1
- require 'paramix'
2
- require 'test/unit'
3
-
4
- class TC_Paramix_Include < Test::Unit::TestCase
5
-
6
- # -- fixture ------------------------------
7
-
8
- module M
9
- include Paramix::Parametric
10
-
11
- parameterized do |params|
12
-
13
- public :f do
14
- params[:p]
15
- end
16
-
17
- end
18
- end
19
-
20
- class C1
21
- include M[:p => "mosh"]
22
- end
23
-
24
- class C2
25
- include M[:p => "many"]
26
- end
27
-
28
- # -- tests --------------------------------
29
-
30
- def test_class_1
31
- assert_equal( "mosh", C1.new.f )
32
- end
33
-
34
- def test_class_2
35
- assert_equal( "many", C2.new.f )
36
- end
37
-
38
- end
39
-