facets 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/AUTHORS +3 -3
  2. data/README +6 -7
  3. data/lib/core/facets.rb +1 -46
  4. data/lib/core/facets/array.rb +3 -0
  5. data/lib/core/facets/array/indexable.rb +6 -1
  6. data/lib/core/facets/array/only.rb +20 -0
  7. data/lib/core/facets/dir/multiglob.rb +12 -1
  8. data/lib/core/facets/enumerable.rb +0 -1
  9. data/lib/core/facets/enumerable/collect.rb +1 -0
  10. data/lib/core/facets/enumerable/combination.rb +44 -90
  11. data/lib/core/facets/facets.rb +46 -0
  12. data/lib/core/facets/file/write.rb +46 -58
  13. data/lib/core/facets/hash.rb +2 -0
  14. data/lib/core/facets/hash/select.rb +14 -0
  15. data/lib/core/facets/integer/multiples.rb +12 -55
  16. data/lib/core/facets/kernel/val.rb +14 -0
  17. data/lib/core/facets/module/alias.rb +28 -9
  18. data/lib/core/facets/module/methods.rb +18 -0
  19. data/lib/core/facets/module/traits.rb +65 -70
  20. data/lib/core/facets/proc/compose.rb +15 -12
  21. data/lib/core/facets/stackable.rb +3 -2
  22. data/lib/core/facets/string/format.rb +4 -6
  23. data/lib/core/facets/string/tabs.rb +34 -0
  24. data/lib/core/facets/symbol.rb +1 -0
  25. data/lib/core/facets/symbol/succ.rb +1 -42
  26. data/lib/core/facets/symbol/to_proc.rb +34 -0
  27. data/lib/methods/facets/array/contains.rb +1 -0
  28. data/lib/methods/facets/facets/require_core.rb +1 -0
  29. data/lib/methods/facets/file/writelines.rb +1 -0
  30. data/lib/methods/facets/io/writelines.rb +1 -0
  31. data/lib/methods/facets/kernel/not_nil.rb +1 -0
  32. data/lib/methods/facets/module/conflict.rb +1 -0
  33. data/lib/methods/facets/module/instance_method_defined.rb +1 -0
  34. data/lib/methods/facets/module/module_method_defined.rb +1 -0
  35. data/lib/methods/facets/module/private_conflict.rb +1 -0
  36. data/lib/methods/facets/module/protected_conflict.rb +1 -0
  37. data/lib/methods/facets/module/public_conflict.rb +1 -0
  38. data/lib/methods/facets/string/expand_tabs.rb +1 -0
  39. data/lib/methods/facets/string/outdent.rb +1 -0
  40. data/lib/methods/facets/string/taballto.rb +1 -0
  41. data/lib/more/facets/arguments.rb +1 -1
  42. data/lib/more/facets/association.rb +0 -46
  43. data/lib/more/facets/autoarray.rb +0 -28
  44. data/lib/more/facets/command.rb +341 -8
  45. data/lib/more/facets/dictionary.rb +25 -131
  46. data/lib/more/facets/downloader.rb +1 -1
  47. data/lib/more/facets/infinity.rb +3 -3
  48. data/lib/more/facets/interval.rb +0 -161
  49. data/lib/more/facets/multiton.rb +16 -12
  50. data/lib/more/facets/namespace.rb +1 -1
  51. data/lib/more/facets/ostruct.rb +46 -10
  52. data/lib/more/facets/overload.rb +0 -51
  53. data/lib/more/facets/paramix.rb +0 -97
  54. data/lib/more/facets/pp_s.rb +30 -0
  55. data/lib/more/facets/progressbar.rb +18 -10
  56. data/lib/more/facets/prototype.rb +1 -40
  57. data/lib/more/facets/random.rb +1 -0
  58. data/lib/more/facets/rbsystem.rb +4 -1
  59. data/lib/more/facets/snapshot.rb +8 -1
  60. data/lib/more/facets/stylize.rb +2 -0
  61. data/meta/{project.yaml → facets-2.0.3.roll} +22 -14
  62. data/meta/manifest.txt +38 -8
  63. data/task/{config.yaml → config/general.yaml} +7 -2
  64. data/task/{rdoc.yaml → config/rdoc.yaml} +1 -1
  65. data/task/crosstest +309 -0
  66. data/task/isotest +293 -0
  67. data/task/loadtest +28 -0
  68. data/task/methods +4 -4
  69. data/task/prepare +5 -0
  70. data/task/publish +2 -2
  71. data/task/rdoc +1 -0
  72. data/task/syntax +29 -0
  73. data/task/test +0 -1
  74. data/task/testeach +42 -0
  75. data/task/testpairs +50 -0
  76. data/test/lib/rq.rb +15 -0
  77. data/test/unit/array/test_merge.rb +21 -43
  78. data/test/unit/array/test_only.rb +21 -0
  79. data/test/unit/enumerable/test_collect.rb +1 -21
  80. data/test/unit/enumerable/test_combination.rb +50 -44
  81. data/test/unit/file/test_topath.rb +48 -57
  82. data/test/unit/file/test_write.rb +82 -0
  83. data/test/unit/hash/test_select.rb +43 -0
  84. data/test/unit/integer/test_multiples.rb +28 -32
  85. data/test/unit/kernel/test_report.rb +9 -12
  86. data/test/unit/kernel/test_val.rb +50 -45
  87. data/test/unit/module/test_include.rb +56 -57
  88. data/test/unit/module/test_name.rb +42 -55
  89. data/test/unit/module/test_traits.rb +46 -47
  90. data/test/unit/string/test_filter.rb +19 -34
  91. data/test/unit/string/test_format.rb +87 -96
  92. data/test/unit/string/test_regesc.rb +18 -26
  93. data/test/unit/string/test_tabs.rb +226 -119
  94. data/test/unit/symbol/test_succ.rb +14 -23
  95. data/test/unit/symbol/test_to_proc.rb +41 -0
  96. data/test/unit/test_association.rb +38 -47
  97. data/test/unit/test_attributes.rb +24 -33
  98. data/test/unit/test_autoarray.rb +23 -32
  99. data/test/unit/test_command.rb +26 -0
  100. data/test/unit/test_dictionary.rb +123 -117
  101. data/test/unit/test_infinity.rb +41 -47
  102. data/test/unit/test_inheritor.rb +133 -142
  103. data/test/unit/test_interval.rb +129 -93
  104. data/test/unit/test_ostruct.rb +148 -101
  105. data/test/unit/test_overload.rb +8 -15
  106. data/test/unit/test_paramix.rb +67 -73
  107. data/test/unit/test_pp_s.rb +23 -0
  108. data/test/unit/test_prototype.rb +28 -38
  109. metadata +47 -11
  110. data/lib/core/facets/enumerable/instance_map.rb +0 -0
  111. data/lib/more/facets/command_options.rb +0 -328
  112. data/meta/version.txt +0 -1
  113. data/task/load +0 -39
  114. data/test/unit/test_command_options.rb +0 -29
@@ -1,52 +1,46 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/infinity.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/infinity.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- class GeneralTest < Test::Unit::TestCase
20
-
21
- def test_pos
22
- assert_equal((1.0/0), INFINITY.to_f)
23
- assert_equal(1, INFINITY<=>5)
24
- assert_equal(1, INFINITY<=>"a")
25
- assert_equal("PosInf", INFINITY.to_s)
26
- end
27
-
28
- def test_neg
29
- assert_equal((-1.0/0), -INFINITY.to_f)
30
- assert_equal(-1, -INFINITY<=>5)
31
- assert_equal(-1, -INFINITY<=>"a")
32
- assert_equal("NegInf", (-INFINITY).to_s)
33
- end
34
-
35
- def test_ord
36
- assert_equal((-1.0/0), -INFINITY.to_f)
37
- assert_equal(-1, 5<=>INFINITY)
38
- assert_equal(1, 5<=>-INFINITY)
39
- end
40
-
41
- def test_eq
42
- assert_equal(Inf, Inf)
43
- assert_equal(-Inf, -Inf)
44
- assert_equal(PosInf, PosInf)
45
- assert_equal(NegInf, NegInf)
46
- assert_not_equal(NaN, NaN)
47
- end
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for facets/infinity.rb
48
8
 
9
+ require 'facets/infinity.rb'
10
+
11
+ require 'test/unit'
12
+
13
+ class GeneralTest < Test::Unit::TestCase
14
+
15
+ def test_pos
16
+ assert_equal((1.0/0), INFINITY.to_f)
17
+ assert_equal(1, INFINITY<=>5)
18
+ assert_equal(1, INFINITY<=>"a")
19
+ assert_equal("PosInf", INFINITY.to_s)
20
+ end
21
+
22
+ def test_neg
23
+ assert_equal((-1.0/0), -INFINITY.to_f)
24
+ assert_equal(-1, -INFINITY<=>5)
25
+ assert_equal(-1, -INFINITY<=>"a")
26
+ assert_equal("NegInf", (-INFINITY).to_s)
49
27
  end
50
28
 
29
+ def test_ord
30
+ assert_equal((-1.0/0), -INFINITY.to_f)
31
+ assert_equal(-1, 5<=>INFINITY)
32
+ assert_equal(1, 5<=>-INFINITY)
33
+ end
34
+
35
+ def test_eq
36
+ assert_equal(Inf, Inf)
37
+ assert_equal(-Inf, -Inf)
38
+ assert_equal(PosInf, PosInf)
39
+ assert_equal(NegInf, NegInf)
40
+ assert_not_equal(NaN, NaN)
41
+ end
42
+
43
+ end
44
+
51
45
 
52
46
 
@@ -1,157 +1,148 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/inheritor.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
12
-
13
- require 'facets/inheritor.rb'
14
-
15
-
16
-
17
- require 'test/unit'
18
-
19
- #class TC01 < Test::Unit::TestCase
20
- # def setup
21
- # @a = [1]
22
- # @i = Inheritor.new( @a, [2], :+ )
23
- # end
24
- # def test_01_001
25
- # assert_equal([2],@i)
26
- # end
27
- # def test_01_002
28
- # assert_equal([1,2],@i.inheritance)
29
- # end
30
- #end
31
-
32
- class TC02 < Test::Unit::TestCase
33
- class C
34
- inheritor :koko, [1], :+
35
- end
36
- class D < C
37
- inheritor :koko, [2], :+
38
- end
39
-
40
- def test_02_001
41
- assert_equal( [1], C.koko! )
42
- end
43
- def test_02_002
44
- assert_equal( [1], C.koko )
45
- end
46
- def test_02_003
47
- assert_equal( [2], D.koko! )
48
- end
49
- def test_02_004
50
- assert_equal( [1,2], D.koko )
51
- end
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for facets/inheritor.rb
8
+
9
+ require 'facets/inheritor.rb'
10
+
11
+ require 'test/unit'
12
+
13
+ #class TC_Inheritor_01 < Test::Unit::TestCase
14
+ # def setup
15
+ # @a = [1]
16
+ # @i = Inheritor.new( @a, [2], :+ )
17
+ # end
18
+ # def test_01_001
19
+ # assert_equal([2],@i)
20
+ # end
21
+ # def test_01_002
22
+ # assert_equal([1,2],@i.inheritance)
23
+ # end
24
+ #end
25
+
26
+ class TC_Inheritor_02 < Test::Unit::TestCase
27
+ class C
28
+ inheritor :koko, [1], :+
29
+ end
30
+ class D < C
31
+ inheritor :koko, [2], :+
52
32
  end
53
33
 
54
- class TC03 < Test::Unit::TestCase
55
- class C
56
- inheritor :koko, [1], :+
57
- end
58
- class D < C
59
- end
60
-
61
- def test_03_001
62
- assert_equal( [1], C.koko! )
63
- end
64
- def test_03_002
65
- assert_equal( [1], C.koko )
66
- end
67
- def test_03_003
68
- assert_equal( [], D.koko! )
69
- end
70
- def test_03_004
71
- assert_equal( [1], D.koko )
72
- end
34
+ def test_02_001
35
+ assert_equal( [1], C.koko! )
73
36
  end
37
+ def test_02_002
38
+ assert_equal( [1], C.koko )
39
+ end
40
+ def test_02_003
41
+ assert_equal( [2], D.koko! )
42
+ end
43
+ def test_02_004
44
+ assert_equal( [1,2], D.koko )
45
+ end
46
+ end
74
47
 
75
- class TC04 < Test::Unit::TestCase
76
- class X
77
- inheritor :x, {:a=>1}, :merge
78
- end
79
- module M
80
- inheritor :x, {:b=>2}, :merge
81
- end
82
- class Y < X
83
- include M
84
- inheritor :x, {:c=>3}, :merge
85
- end
48
+ class TC_Inheritor_03 < Test::Unit::TestCase
49
+ class C
50
+ inheritor :koko, [1], :+
51
+ end
52
+ class D < C
53
+ end
86
54
 
87
- def test_04_001
88
- assert_equal( {:a=>1}, X.x )
89
- end
90
- def test_04_002
91
- assert_equal( 2, M.x[:b] )
92
- end
93
- def test_04_003
94
- assert_equal( {:a=>1,:b=>2,:c=>3}, Y.x )
95
- end
96
- def test_04_004
97
- assert_equal( 1, X.x[:a] )
98
- assert_equal( nil, X.x[:b] )
99
- assert_equal( nil, X.x[:c] )
100
- end
101
- def test_04_005 ; assert_equal( 1, Y.x[:a] ) ; end
102
- def test_04_006 ; assert_equal( 2, Y.x[:b] ) ; end
103
- def test_04_007 ; assert_equal( 3, Y.x[:c] ) ; end
104
- def test_04_008
105
- Y.x![:d] = 4
106
- assert_equal( 4, Y.x[:d] )
107
- end
55
+ def test_03_001
56
+ assert_equal( [1], C.koko! )
57
+ end
58
+ def test_03_002
59
+ assert_equal( [1], C.koko )
60
+ end
61
+ def test_03_003
62
+ assert_equal( [], D.koko! )
63
+ end
64
+ def test_03_004
65
+ assert_equal( [1], D.koko )
108
66
  end
67
+ end
109
68
 
110
- class TC05 < Test::Unit::TestCase
111
- class C
112
- inheritor :relations, [], :concat
113
- end
114
- class D < C
115
- #inheritor :relations, [], :concat
116
- end
69
+ class TC_Inheritor_04 < Test::Unit::TestCase
70
+ class X
71
+ inheritor :x, {:a=>1}, :merge
72
+ end
73
+ module M
74
+ inheritor :x, {:b=>2}, :merge
75
+ end
76
+ class Y < X
77
+ include M
78
+ inheritor :x, {:c=>3}, :merge
79
+ end
117
80
 
118
- C.relations! << 1
119
- C.relations! << 2
120
- D.relations! << 3
81
+ def test_04_001
82
+ assert_equal( {:a=>1}, X.x )
83
+ end
84
+ def test_04_002
85
+ assert_equal( 2, M.x[:b] )
86
+ end
87
+ def test_04_003
88
+ assert_equal( {:a=>1,:b=>2,:c=>3}, Y.x )
89
+ end
90
+ def test_04_004
91
+ assert_equal( 1, X.x[:a] )
92
+ assert_equal( nil, X.x[:b] )
93
+ assert_equal( nil, X.x[:c] )
94
+ end
95
+ def test_04_005 ; assert_equal( 1, Y.x[:a] ) ; end
96
+ def test_04_006 ; assert_equal( 2, Y.x[:b] ) ; end
97
+ def test_04_007 ; assert_equal( 3, Y.x[:c] ) ; end
98
+ def test_04_008
99
+ Y.x![:d] = 4
100
+ assert_equal( 4, Y.x[:d] )
101
+ end
102
+ end
121
103
 
122
- def test_05_001
123
- assert_equal( [1,2], C.relations )
124
- assert_equal( [1,2,3], D.relations )
125
- end
104
+ class TC_Inheritor_05 < Test::Unit::TestCase
105
+ class C
106
+ inheritor :relations, [], :concat
107
+ end
108
+ class D < C
109
+ #inheritor :relations, [], :concat
126
110
  end
127
111
 
128
- class TC06 < Test::Unit::TestCase
129
- module MM
130
- inheritor :koko, [], :+
131
- koko! << 1
132
- end
133
- class CC1
134
- include MM
135
- #inheritor :koko, [], :+
136
- koko! << 2
137
- koko! << 3
138
- end
139
- class CC2
140
- include MM
141
- #inheritor :koko, [], :+
142
- koko! << 4
143
- end
112
+ C.relations! << 1
113
+ C.relations! << 2
114
+ D.relations! << 3
144
115
 
145
- def test_06_001
146
- assert_equal( [1], MM.koko )
147
- end
148
- def test_06_002
149
- assert_equal( [1,2,3], CC1.koko )
150
- end
151
- def test_06_003
152
- assert_equal( [1,4], CC2.koko )
153
- end
116
+ def test_05_001
117
+ assert_equal( [1,2], C.relations )
118
+ assert_equal( [1,2,3], D.relations )
154
119
  end
120
+ end
155
121
 
122
+ class TC_Inheritor_06 < Test::Unit::TestCase
123
+ module MM
124
+ inheritor :koko, [], :+
125
+ koko! << 1
126
+ end
127
+ class CC1
128
+ include MM
129
+ #inheritor :koko, [], :+
130
+ koko! << 2
131
+ koko! << 3
132
+ end
133
+ class CC2
134
+ include MM
135
+ #inheritor :koko, [], :+
136
+ koko! << 4
137
+ end
156
138
 
157
-
139
+ def test_06_001
140
+ assert_equal( [1], MM.koko )
141
+ end
142
+ def test_06_002
143
+ assert_equal( [1,2,3], CC1.koko )
144
+ end
145
+ def test_06_003
146
+ assert_equal( [1,4], CC2.koko )
147
+ end
148
+ end
@@ -1,121 +1,157 @@
1
- # _____ _
2
- # |_ _|__ ___| |_
3
- # | |/ _ \/ __| __|
4
- # | | __/\__ \ |
5
- # |_|\___||___/\__|
6
- #
7
- # for lib/facets/interval.rb
8
- #
9
- # Extracted Mon Sep 03 16:23:07 -0700 2007
10
- # w/ Test Extraction Ratchet
11
- #
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for facets/interval.rb
12
8
 
13
- require 'facets/interval.rb'
9
+ require 'facets/interval.rb'
14
10
 
11
+ require 'test/unit'
15
12
 
13
+ class InclusiveTest < Test::Unit::TestCase
16
14
 
17
- require 'test/unit'
18
-
19
- class InclusiveTest < Test::Unit::TestCase
20
-
21
- def setup
22
- @a = Interval.new( 1, 10 )
23
- @b = Interval.new( 1, 10, true, false )
24
- @c = Interval.new( 1, 10, false, true )
25
- @d = Interval.new( 1, 10, true, true )
26
- end
27
-
28
- def test_001A ; assert_equal( false, @a.include?(0) ) ; end
29
- def test_002A ; assert_equal( true, @a.include?(1) ) ; end
30
- def test_003A ; assert_equal( true, @a.include?(2) ) ; end
31
- def test_004A ; assert_equal( true, @a.include?(9) ) ; end
32
- def test_005A ; assert_equal( true, @a.include?(10) ) ; end
33
- def test_006A ; assert_equal( false, @a.include?(11) ) ; end
34
-
35
- def test_001B ; assert_equal( false, @b.include?(0) ) ; end
36
- def test_002B ; assert_equal( false, @b.include?(1) ) ; end
37
- def test_003B ; assert_equal( true, @b.include?(2) ) ; end
38
- def test_004B ; assert_equal( true, @b.include?(9) ) ; end
39
- def test_005B ; assert_equal( true, @b.include?(10) ) ; end
40
- def test_006B ; assert_equal( false, @b.include?(11) ) ; end
41
-
42
- def test_001C ; assert_equal( false, @c.include?(0) ) ; end
43
- def test_002C ; assert_equal( true, @c.include?(1) ) ; end
44
- def test_003C ; assert_equal( true, @c.include?(2) ) ; end
45
- def test_004C ; assert_equal( true, @c.include?(9) ) ; end
46
- def test_005C ; assert_equal( false, @c.include?(10) ) ; end
47
- def test_006C ; assert_equal( false, @c.include?(11) ) ; end
48
-
49
- def test_001D ; assert_equal( false, @d.include?(0) ) ; end
50
- def test_002D ; assert_equal( false, @d.include?(1) ) ; end
51
- def test_003D ; assert_equal( true, @d.include?(2) ) ; end
52
- def test_004D ; assert_equal( true, @d.include?(9) ) ; end
53
- def test_005D ; assert_equal( false, @d.include?(10) ) ; end
54
- def test_006D ; assert_equal( false, @d.include?(11) ) ; end
15
+ def setup
16
+ @a = Interval.new( 1, 10 )
17
+ @b = Interval.new( 1, 10, true, false )
18
+ @c = Interval.new( 1, 10, false, true )
19
+ @d = Interval.new( 1, 10, true, true )
20
+ end
55
21
 
22
+ def test_001A ; assert_equal( false, @a.include?(0) ) ; end
23
+ def test_002A ; assert_equal( true, @a.include?(1) ) ; end
24
+ def test_003A ; assert_equal( true, @a.include?(2) ) ; end
25
+ def test_004A ; assert_equal( true, @a.include?(9) ) ; end
26
+ def test_005A ; assert_equal( true, @a.include?(10) ) ; end
27
+ def test_006A ; assert_equal( false, @a.include?(11) ) ; end
28
+
29
+ def test_001B ; assert_equal( false, @b.include?(0) ) ; end
30
+ def test_002B ; assert_equal( false, @b.include?(1) ) ; end
31
+ def test_003B ; assert_equal( true, @b.include?(2) ) ; end
32
+ def test_004B ; assert_equal( true, @b.include?(9) ) ; end
33
+ def test_005B ; assert_equal( true, @b.include?(10) ) ; end
34
+ def test_006B ; assert_equal( false, @b.include?(11) ) ; end
35
+
36
+ def test_001C ; assert_equal( false, @c.include?(0) ) ; end
37
+ def test_002C ; assert_equal( true, @c.include?(1) ) ; end
38
+ def test_003C ; assert_equal( true, @c.include?(2) ) ; end
39
+ def test_004C ; assert_equal( true, @c.include?(9) ) ; end
40
+ def test_005C ; assert_equal( false, @c.include?(10) ) ; end
41
+ def test_006C ; assert_equal( false, @c.include?(11) ) ; end
42
+
43
+ def test_001D ; assert_equal( false, @d.include?(0) ) ; end
44
+ def test_002D ; assert_equal( false, @d.include?(1) ) ; end
45
+ def test_003D ; assert_equal( true, @d.include?(2) ) ; end
46
+ def test_004D ; assert_equal( true, @d.include?(9) ) ; end
47
+ def test_005D ; assert_equal( false, @d.include?(10) ) ; end
48
+ def test_006D ; assert_equal( false, @d.include?(11) ) ; end
49
+
50
+ end
51
+
52
+ class LrgNumericTest < Test::Unit::TestCase
53
+
54
+ def setup
55
+ @a = Interval.new(0,100000000)
56
+ @b = Interval.new(0,100000000)
56
57
  end
57
58
 
58
- class LrgNumericTest < Test::Unit::TestCase
59
+ def test_001A ; assert_equal( true, @a.include?(0) ) ; end
60
+ def test_002A ; assert_equal( true, @a.include?(1000) ) ; end
61
+ def test_003A ; assert_equal( true, @a.include?(1000000) ) ; end
62
+ def test_004A ; assert_equal( true, @a.include?(100000000) ) ; end
63
+ #def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
59
64
 
60
- def setup
61
- @a = Interval.new(0,100000000)
62
- @b = Interval.new(0,100000000)
63
- end
65
+ def test_001B ; assert_equal( true, @b.include?(0) ) ; end
66
+ def test_002B ; assert_equal( true, @b.include?(5) ) ; end
67
+ def test_002B ; assert_equal( true, @b.include?(70007) ) ; end
68
+ def test_002B ; assert_equal( true, @b.include?(5000005) ) ; end
69
+ #def test_002B ; assert_equal( false, @b.include?(INFINITY) ) ; end
64
70
 
65
- def test_001A ; assert_equal( true, @a.include?(0) ) ; end
66
- def test_002A ; assert_equal( true, @a.include?(1000) ) ; end
67
- def test_003A ; assert_equal( true, @a.include?(1000000) ) ; end
68
- def test_004A ; assert_equal( true, @a.include?(100000000) ) ; end
69
- #def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
71
+ end
70
72
 
71
- def test_001B ; assert_equal( true, @b.include?(0) ) ; end
72
- def test_002B ; assert_equal( true, @b.include?(5) ) ; end
73
- def test_002B ; assert_equal( true, @b.include?(70007) ) ; end
74
- def test_002B ; assert_equal( true, @b.include?(5000005) ) ; end
75
- #def test_002B ; assert_equal( false, @b.include?(INFINITY) ) ; end
73
+ class SelectTest < Test::Unit::TestCase
76
74
 
75
+ def setup
76
+ @a = Interval.new( 0,10 )
77
77
  end
78
78
 
79
- class SelectTest < Test::Unit::TestCase
79
+ def test_001
80
+ b = @a.collect( 2 ){ |n| n }
81
+ assert_equal( [0,2,4,6,8,10], b )
82
+ end
80
83
 
81
- def setup
82
- @a = Interval.new( 0,10 )
83
- end
84
+ def test_002
85
+ b = @a.select{ |n| n % 2 == 0 }
86
+ assert_equal( [0,2,4,6,8,10], b )
87
+ end
84
88
 
85
- def test_001
86
- b = @a.collect( 2 ){ |n| n }
87
- assert_equal( [0,2,4,6,8,10], b )
88
- end
89
+ def test_003
90
+ b = @a.collect( 1,2 ){ |n| n }
91
+ assert_equal( [0,5,10], b )
92
+ end
89
93
 
90
- def test_002
91
- b = @a.select{ |n| n % 2 == 0 }
92
- assert_equal( [0,2,4,6,8,10], b )
93
- end
94
+ def test_004
95
+ b = @a.select( 1,2 ){ |n| n % 2 == 0 }
96
+ assert_equal( [0,10], b )
97
+ end
94
98
 
95
- def test_003
96
- b = @a.collect( 1,2 ){ |n| n }
97
- assert_equal( [0,5,10], b )
98
- end
99
+ end
99
100
 
100
- def test_004
101
- b = @a.select( 1,2 ){ |n| n % 2 == 0 }
102
- assert_equal( [0,10], b )
103
- end
101
+ class ArrayTest < Test::Unit::TestCase
104
102
 
103
+ def setup
104
+ @a = Interval.new( 0,10 )
105
+ @b = Interval.new( 0,1 )
105
106
  end
106
107
 
107
- class ArrayTest < Test::Unit::TestCase
108
+ def test_001A ; assert_equal( [0,5,10], @a.to_a(1,2) ) ; end
108
109
 
109
- def setup
110
- @a = Interval.new( 0,10 )
111
- @b = Interval.new( 0,1 )
112
- end
110
+ def test_001B ; assert_equal( [0, 0.25, 0.5, 0.75, 1.0], @b.to_a(1,4) ) ; end
113
111
 
114
- def test_001A ; assert_equal( [0,5,10], @a.to_a(1,2) ) ; end
112
+ end
115
113
 
116
- def test_001B ; assert_equal( [0, 0.25, 0.5, 0.75, 1.0], @b.to_a(1,4) ) ; end
117
114
 
118
- end
115
+ =begin
116
+ class InfTest < Test::Unit::TestCase
119
117
 
118
+ def setup
119
+ @a = Interval.new( -INFINITY, -3 )
120
+ @b = Interval.new( -INFINITY, -3, true, false )
121
+ @c = Interval.new( -3, INFINITY )
122
+ @d = Interval.new( -INFINITY, INFINITY )
123
+ @e = Interval.new( -3, -2 )
124
+ end
120
125
 
126
+ def test_001A ; assert_equal( true, @a.include?(-INFINITY) ) ; end
127
+ def test_002A ; assert_equal( true, @a.include?(-4) ) ; end
128
+ def test_003A ; assert_equal( true, @a.include?(-3) ) ; end
129
+ def test_004A ; assert_equal( false, @a.include?(-2) ) ; end
130
+ def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
131
+
132
+ def test_001B ; assert_equal( true, @b.include?(-INFINITY) ) ; end
133
+ def test_002B ; assert_equal( true, @b.include?(-4) ) ; end
134
+ def test_003B ; assert_equal( false, @b.include?(-3) ) ; end
135
+ def test_004B ; assert_equal( false, @b.include?(-2) ) ; end
136
+ def test_005B ; assert_equal( false, @b.include?(INFINITY) ) ; end
137
+
138
+ def test_001C ; assert_equal( false, @c.include?(-INFINITY) ) ; end
139
+ def test_002C ; assert_equal( false, @c.include?(-4) ) ; end
140
+ def test_003C ; assert_equal( true, @c.include?(-3) ) ; end
141
+ def test_004C ; assert_equal( true, @c.include?(-2) ) ; end
142
+ def test_005C ; assert_equal( true, @c.include?(INFINITY) ) ; end
143
+
144
+ def test_001D ; assert_equal( true, @d.include?(-INFINITY) ) ; end
145
+ def test_002D ; assert_equal( true, @d.include?(-4) ) ; end
146
+ def test_003D ; assert_equal( true, @d.include?(-3) ) ; end
147
+ def test_004D ; assert_equal( true, @d.include?(-2) ) ; end
148
+ def test_005D ; assert_equal( true, @d.include?(INFINITY) ) ; end
149
+
150
+ def test_001E ; assert_equal( false, @e.include?(-INFINITY) ) ; end
151
+ def test_002E ; assert_equal( false, @e.include?(-4) ) ; end
152
+ def test_003E ; assert_equal( true, @e.include?(-3) ) ; end
153
+ def test_004E ; assert_equal( true, @e.include?(-2) ) ; end
154
+ def test_005E ; assert_equal( false, @e.include?(INFINITY) ) ; end
121
155
 
156
+ end
157
+ =end