facets 2.0.2 → 2.0.3
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/AUTHORS +3 -3
- data/README +6 -7
- data/lib/core/facets.rb +1 -46
- data/lib/core/facets/array.rb +3 -0
- data/lib/core/facets/array/indexable.rb +6 -1
- data/lib/core/facets/array/only.rb +20 -0
- data/lib/core/facets/dir/multiglob.rb +12 -1
- data/lib/core/facets/enumerable.rb +0 -1
- data/lib/core/facets/enumerable/collect.rb +1 -0
- data/lib/core/facets/enumerable/combination.rb +44 -90
- data/lib/core/facets/facets.rb +46 -0
- data/lib/core/facets/file/write.rb +46 -58
- data/lib/core/facets/hash.rb +2 -0
- data/lib/core/facets/hash/select.rb +14 -0
- data/lib/core/facets/integer/multiples.rb +12 -55
- data/lib/core/facets/kernel/val.rb +14 -0
- data/lib/core/facets/module/alias.rb +28 -9
- data/lib/core/facets/module/methods.rb +18 -0
- data/lib/core/facets/module/traits.rb +65 -70
- data/lib/core/facets/proc/compose.rb +15 -12
- data/lib/core/facets/stackable.rb +3 -2
- data/lib/core/facets/string/format.rb +4 -6
- data/lib/core/facets/string/tabs.rb +34 -0
- data/lib/core/facets/symbol.rb +1 -0
- data/lib/core/facets/symbol/succ.rb +1 -42
- data/lib/core/facets/symbol/to_proc.rb +34 -0
- data/lib/methods/facets/array/contains.rb +1 -0
- data/lib/methods/facets/facets/require_core.rb +1 -0
- data/lib/methods/facets/file/writelines.rb +1 -0
- data/lib/methods/facets/io/writelines.rb +1 -0
- data/lib/methods/facets/kernel/not_nil.rb +1 -0
- data/lib/methods/facets/module/conflict.rb +1 -0
- data/lib/methods/facets/module/instance_method_defined.rb +1 -0
- data/lib/methods/facets/module/module_method_defined.rb +1 -0
- data/lib/methods/facets/module/private_conflict.rb +1 -0
- data/lib/methods/facets/module/protected_conflict.rb +1 -0
- data/lib/methods/facets/module/public_conflict.rb +1 -0
- data/lib/methods/facets/string/expand_tabs.rb +1 -0
- data/lib/methods/facets/string/outdent.rb +1 -0
- data/lib/methods/facets/string/taballto.rb +1 -0
- data/lib/more/facets/arguments.rb +1 -1
- data/lib/more/facets/association.rb +0 -46
- data/lib/more/facets/autoarray.rb +0 -28
- data/lib/more/facets/command.rb +341 -8
- data/lib/more/facets/dictionary.rb +25 -131
- data/lib/more/facets/downloader.rb +1 -1
- data/lib/more/facets/infinity.rb +3 -3
- data/lib/more/facets/interval.rb +0 -161
- data/lib/more/facets/multiton.rb +16 -12
- data/lib/more/facets/namespace.rb +1 -1
- data/lib/more/facets/ostruct.rb +46 -10
- data/lib/more/facets/overload.rb +0 -51
- data/lib/more/facets/paramix.rb +0 -97
- data/lib/more/facets/pp_s.rb +30 -0
- data/lib/more/facets/progressbar.rb +18 -10
- data/lib/more/facets/prototype.rb +1 -40
- data/lib/more/facets/random.rb +1 -0
- data/lib/more/facets/rbsystem.rb +4 -1
- data/lib/more/facets/snapshot.rb +8 -1
- data/lib/more/facets/stylize.rb +2 -0
- data/meta/{project.yaml → facets-2.0.3.roll} +22 -14
- data/meta/manifest.txt +38 -8
- data/task/{config.yaml → config/general.yaml} +7 -2
- data/task/{rdoc.yaml → config/rdoc.yaml} +1 -1
- data/task/crosstest +309 -0
- data/task/isotest +293 -0
- data/task/loadtest +28 -0
- data/task/methods +4 -4
- data/task/prepare +5 -0
- data/task/publish +2 -2
- data/task/rdoc +1 -0
- data/task/syntax +29 -0
- data/task/test +0 -1
- data/task/testeach +42 -0
- data/task/testpairs +50 -0
- data/test/lib/rq.rb +15 -0
- data/test/unit/array/test_merge.rb +21 -43
- data/test/unit/array/test_only.rb +21 -0
- data/test/unit/enumerable/test_collect.rb +1 -21
- data/test/unit/enumerable/test_combination.rb +50 -44
- data/test/unit/file/test_topath.rb +48 -57
- data/test/unit/file/test_write.rb +82 -0
- data/test/unit/hash/test_select.rb +43 -0
- data/test/unit/integer/test_multiples.rb +28 -32
- data/test/unit/kernel/test_report.rb +9 -12
- data/test/unit/kernel/test_val.rb +50 -45
- data/test/unit/module/test_include.rb +56 -57
- data/test/unit/module/test_name.rb +42 -55
- data/test/unit/module/test_traits.rb +46 -47
- data/test/unit/string/test_filter.rb +19 -34
- data/test/unit/string/test_format.rb +87 -96
- data/test/unit/string/test_regesc.rb +18 -26
- data/test/unit/string/test_tabs.rb +226 -119
- data/test/unit/symbol/test_succ.rb +14 -23
- data/test/unit/symbol/test_to_proc.rb +41 -0
- data/test/unit/test_association.rb +38 -47
- data/test/unit/test_attributes.rb +24 -33
- data/test/unit/test_autoarray.rb +23 -32
- data/test/unit/test_command.rb +26 -0
- data/test/unit/test_dictionary.rb +123 -117
- data/test/unit/test_infinity.rb +41 -47
- data/test/unit/test_inheritor.rb +133 -142
- data/test/unit/test_interval.rb +129 -93
- data/test/unit/test_ostruct.rb +148 -101
- data/test/unit/test_overload.rb +8 -15
- data/test/unit/test_paramix.rb +67 -73
- data/test/unit/test_pp_s.rb +23 -0
- data/test/unit/test_prototype.rb +28 -38
- metadata +47 -11
- data/lib/core/facets/enumerable/instance_map.rb +0 -0
- data/lib/more/facets/command_options.rb +0 -328
- data/meta/version.txt +0 -1
- data/task/load +0 -39
- data/test/unit/test_command_options.rb +0 -29
data/test/unit/test_infinity.rb
CHANGED
@@ -1,52 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
|
data/test/unit/test_inheritor.rb
CHANGED
@@ -1,157 +1,148 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
55
|
-
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
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
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
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
|
-
|
129
|
-
|
130
|
-
|
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
|
-
|
146
|
-
|
147
|
-
|
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
|
data/test/unit/test_interval.rb
CHANGED
@@ -1,121 +1,157 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
9
|
+
require 'facets/interval.rb'
|
14
10
|
|
11
|
+
require 'test/unit'
|
15
12
|
|
13
|
+
class InclusiveTest < Test::Unit::TestCase
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
+
def test_003
|
90
|
+
b = @a.collect( 1,2 ){ |n| n }
|
91
|
+
assert_equal( [0,5,10], b )
|
92
|
+
end
|
89
93
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
96
|
-
b = @a.collect( 1,2 ){ |n| n }
|
97
|
-
assert_equal( [0,5,10], b )
|
98
|
-
end
|
99
|
+
end
|
99
100
|
|
100
|
-
|
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
|
-
|
108
|
+
def test_001A ; assert_equal( [0,5,10], @a.to_a(1,2) ) ; end
|
108
109
|
|
109
|
-
|
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
|
-
|
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
|
-
|
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
|