sixarm_ruby_ramp 4.2.3 → 4.2.4
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +3 -2
- data/lib/sixarm_ruby_ramp/array/join.rb +2 -0
- data/lib/sixarm_ruby_ramp/enumerable/each.rb +149 -0
- data/lib/sixarm_ruby_ramp/integer/rbit.rb +2 -0
- data/lib/sixarm_ruby_ramp/integer.rb +7 -4
- data/lib/sixarm_ruby_ramp/string.rb +1 -1
- data/lib/sixarm_ruby_ramp.rb +1 -1
- data/test/sixarm_ruby_ramp_test/array/join_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/array/shuffle_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/array_test.rb +2 -3
- data/test/sixarm_ruby_ramp_test/class_test.rb +2 -4
- data/test/sixarm_ruby_ramp_test/csv_test.rb +3 -5
- data/test/sixarm_ruby_ramp_test/date_test.rb +13 -15
- data/test/sixarm_ruby_ramp_test/enumerable/each_test.rb +337 -0
- data/test/sixarm_ruby_ramp_test/enumerable/map_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/enumerable/nitems_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/enumerable/select_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/enumerable_test.rb +2 -4
- data/test/sixarm_ruby_ramp_test/file_test.rb +4 -6
- data/test/sixarm_ruby_ramp_test/fixnum_test.rb +2 -4
- data/test/sixarm_ruby_ramp_test/hash_test.rb +2 -2
- data/test/sixarm_ruby_ramp_test/integer/rbit_test.rb +1 -1
- data/test/sixarm_ruby_ramp_test/integer_test.rb +4 -5
- data/test/sixarm_ruby_ramp_test/io_test.rb +2 -3
- data/test/sixarm_ruby_ramp_test/kernel_test.rb +5 -6
- data/test/sixarm_ruby_ramp_test/math_test.rb +2 -3
- data/test/sixarm_ruby_ramp_test/nil_test.rb +2 -3
- data/test/sixarm_ruby_ramp_test/numeric_test.rb +2 -2
- data/test/sixarm_ruby_ramp_test/object_test.rb +2 -3
- data/test/sixarm_ruby_ramp_test/pairable_test.rb +2 -2
- data/test/sixarm_ruby_ramp_test/process_test.rb +2 -2
- data/test/sixarm_ruby_ramp_test/string_test.rb +2 -27
- data/test/sixarm_ruby_ramp_test/symbol_test.rb +2 -16
- data/test/sixarm_ruby_ramp_test/time_test.rb +3 -4
- data/test/sixarm_ruby_ramp_test/yaml_test.rb +2 -6
- data/test/sixarm_ruby_ramp_test.rb +5 -33
- data.tar.gz.sig +0 -0
- metadata +85 -11
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/CHANGES.md +0 -24
- data/CONTRIBUTING.md +0 -28
- data/LICENSE.md +0 -28
- data/README.md +0 -249
- data/VERSION +0 -1
- data/lib/sixarm_ruby_ramp/xml.rb +0 -0
- data/test/sixarm_ruby_ramp_test/xml_test.rb +0 -10
@@ -0,0 +1,337 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/enumerable/each"
|
4
|
+
|
5
|
+
class EnumerableEachTest < Minitest::Test
|
6
|
+
|
7
|
+
LIST = ["a", "b", "c", "d", "e", "f"]
|
8
|
+
|
9
|
+
### #each_at
|
10
|
+
|
11
|
+
def test_each_at_with_numeric_positive
|
12
|
+
filter = 1
|
13
|
+
expect = ["b"]
|
14
|
+
actual = []
|
15
|
+
LIST.each_at(filter){|o| actual << o}
|
16
|
+
assert_equal(expect, actual)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_each_at_with_numeric_negative
|
20
|
+
filter = -1
|
21
|
+
expect = ["f"]
|
22
|
+
actual = []
|
23
|
+
LIST.each_at(filter){|o| actual << o}
|
24
|
+
assert_equal(expect, actual)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_each_at_with_enumerable_positives_asendining
|
28
|
+
filter = [1, 2]
|
29
|
+
expect = ["b", "c"]
|
30
|
+
actual = []
|
31
|
+
LIST.each_at(filter){|o| actual << o}
|
32
|
+
assert_equal(expect, actual)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_each_at_with_enumerable_positives_descending
|
36
|
+
filter = [2, 1]
|
37
|
+
expect = ["c", "b"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
38
|
+
actual = []
|
39
|
+
LIST.each_at(filter){|o| actual << o}
|
40
|
+
assert_equal(expect, actual)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_each_at_with_enumerable_negatives_ascending
|
44
|
+
filter = [-2, -1]
|
45
|
+
expect = ["e", "f"]
|
46
|
+
actual = []
|
47
|
+
LIST.each_at(filter){|o| actual << o}
|
48
|
+
assert_equal(expect, actual)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_each_at_with_enumerable_negatives_descending
|
52
|
+
filter = [-1, -2]
|
53
|
+
expect = ["f", "e"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
54
|
+
actual = []
|
55
|
+
LIST.each_at(filter){|o| actual << o}
|
56
|
+
assert_equal(expect, actual)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_each_at_strategy_with_optimization_max_with_range_positives_ascending
|
60
|
+
filter = 1..2
|
61
|
+
expect = ["b", "c"]
|
62
|
+
actual = []
|
63
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
64
|
+
assert_equal(expect, actual)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_each_at_with_range_positives_descending
|
68
|
+
filter = 2..1
|
69
|
+
expect = [] # Degenerate because filter#each will noop.
|
70
|
+
actual = []
|
71
|
+
LIST.each_at(filter){|o| actual << o}
|
72
|
+
assert_equal(expect, actual)
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_each_at_with_range_negatives_ascending
|
76
|
+
filter = -2..-1
|
77
|
+
expect = ["e", "f"]
|
78
|
+
actual = []
|
79
|
+
LIST.each_at(filter){|o| actual << o}
|
80
|
+
assert_equal(expect, actual)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_each_at_with_range_negatives_descending
|
84
|
+
filter = -1..-2
|
85
|
+
expect = [] # Degenerate because filter#each will noop.
|
86
|
+
actual = []
|
87
|
+
LIST.each_at(filter){|o| actual << o}
|
88
|
+
assert_equal(expect, actual)
|
89
|
+
end
|
90
|
+
|
91
|
+
### #each_at_strategy_with_optimization_off
|
92
|
+
|
93
|
+
def test_each_at_strategy_with_optimization_off_with_numeric_positive
|
94
|
+
filter = [1] # Note: must be wrapped in an array because the strategy presumes filter#include?.
|
95
|
+
expect = ["b"]
|
96
|
+
actual = []
|
97
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
98
|
+
assert_equal(expect, actual)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_each_at_strategy_with_optimization_off_with_numeric_negative
|
102
|
+
filter = [-1] # Note: must be wrapped in an array because the strategy 0 presumes filter#include?.
|
103
|
+
expect = ["f"]
|
104
|
+
actual = []
|
105
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
106
|
+
assert_equal(expect, actual)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_each_at_strategy_with_optimization_off_with_enumerable_positives_asendining
|
110
|
+
filter = [1, 2]
|
111
|
+
expect = ["b", "c"]
|
112
|
+
actual = []
|
113
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
114
|
+
assert_equal(expect, actual)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_each_at_strategy_with_optimization_off_with_enumerable_positives_descending
|
118
|
+
filter = [2, 1]
|
119
|
+
expect = ["b", "c"] # Note: order depends on LIST, not filter, because the strategy uses filter#include?.
|
120
|
+
actual = []
|
121
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
122
|
+
assert_equal(expect, actual)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_each_at_strategy_with_optimization_off_with_enumerable_negatives_ascending
|
126
|
+
filter = [-2, -1]
|
127
|
+
expect = ["e", "f"]
|
128
|
+
actual = []
|
129
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
130
|
+
assert_equal(expect, actual)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_each_at_strategy_with_optimization_off_with_enumerable_negatives_descending
|
134
|
+
filter = [-1, -2]
|
135
|
+
expect = ["e", "f"] # Note: order depends on LIST, not filter, because the strategy uses filter#include?.
|
136
|
+
actual = []
|
137
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
138
|
+
assert_equal(expect, actual)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_each_at_strategy_with_optimization_off_with_range_positives_ascending
|
142
|
+
filter = 1..2
|
143
|
+
expect = ["b", "c"]
|
144
|
+
actual = []
|
145
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
146
|
+
assert_equal(expect, actual)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_each_at_strategy_with_optimization_off_with_range_positives_descending
|
150
|
+
filter = 2..1
|
151
|
+
expect = [] # Degenerate because filter#include? will always be false.
|
152
|
+
actual = []
|
153
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
154
|
+
assert_equal(expect, actual)
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_each_at_strategy_with_optimization_off_with_range_negatives_ascending
|
158
|
+
filter = -2..-1
|
159
|
+
expect = ["e", "f"]
|
160
|
+
actual = []
|
161
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
162
|
+
assert_equal(expect, actual)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_each_at_strategy_with_optimization_off_with_range_negatives_descending
|
166
|
+
filter = -1..-2
|
167
|
+
expect = [] # Degenerate because filter#include? will always be false.
|
168
|
+
actual = []
|
169
|
+
LIST.each_at_strategy_with_optimization_off(filter){|o| actual << o}
|
170
|
+
assert_equal(expect, actual)
|
171
|
+
end
|
172
|
+
|
173
|
+
### #each_at_strategy_with_optimization_min
|
174
|
+
|
175
|
+
def test_each_at_strategy_with_optimization_min_with_numeric_positive
|
176
|
+
filter = [1] # Note: must be wrapped in an array because the strategy presumes filter#each.
|
177
|
+
expect = ["b"]
|
178
|
+
actual = []
|
179
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
180
|
+
assert_equal(expect, actual)
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_each_at_strategy_with_optimization_min_with_numeric_negative
|
184
|
+
filter = [-1] # Note: must be wrapped in an array because then strategy presumes filter#each.
|
185
|
+
expect = ["f"]
|
186
|
+
actual = []
|
187
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
188
|
+
assert_equal(expect, actual)
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_each_at_strategy_with_optimization_min_with_enumerable_positives_asendining
|
192
|
+
filter = [1, 2]
|
193
|
+
expect = ["b", "c"]
|
194
|
+
actual = []
|
195
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
196
|
+
assert_equal(expect, actual)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_each_at_strategy_with_optimization_min_with_enumerable_positives_descending
|
200
|
+
filter = [2, 1]
|
201
|
+
expect = ["c", "b"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
202
|
+
actual = []
|
203
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
204
|
+
assert_equal(expect, actual)
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_each_at_strategy_with_optimization_min_with_enumerable_negatives_ascending
|
208
|
+
filter = [-2, -1]
|
209
|
+
expect = ["e", "f"]
|
210
|
+
actual = []
|
211
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
212
|
+
assert_equal(expect, actual)
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_each_at_strategy_with_optimization_min_with_enumerable_negatives_descending
|
216
|
+
filter = [-1, -2]
|
217
|
+
expect = ["f", "e"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
218
|
+
actual = []
|
219
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
220
|
+
assert_equal(expect, actual)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_each_at_strategy_with_optimization_min_with_range_positives_ascending
|
224
|
+
filter = 1..2
|
225
|
+
expect = ["b", "c"]
|
226
|
+
actual = []
|
227
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
228
|
+
assert_equal(expect, actual)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_each_at_strategy_with_optimization_min_with_range_positives_descending
|
232
|
+
filter = 2..1
|
233
|
+
expect = [] # Degenerate because filter#each will noop.
|
234
|
+
actual = []
|
235
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
236
|
+
assert_equal(expect, actual)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_each_at_strategy_with_optimization_min_with_range_negatives_ascending
|
240
|
+
filter = -2..-1
|
241
|
+
expect = ["e", "f"]
|
242
|
+
actual = []
|
243
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
244
|
+
assert_equal(expect, actual)
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_each_at_strategy_with_optimization_min_with_range_negatives_descending
|
248
|
+
filter = -1..-2
|
249
|
+
expect = [] # Degenerate because filter#each will noop.
|
250
|
+
actual = []
|
251
|
+
LIST.each_at_strategy_with_optimization_min(filter){|o| actual << o}
|
252
|
+
assert_equal(expect, actual)
|
253
|
+
end
|
254
|
+
|
255
|
+
### #each_at_strategy_with_optimization_max
|
256
|
+
|
257
|
+
def test_each_at_strategy_with_optimization_max_with_numeric_positive
|
258
|
+
filter = [1] # Note: must be wrapped in an array because the strategy presumes filter#each.
|
259
|
+
expect = ["b"]
|
260
|
+
actual = []
|
261
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
262
|
+
assert_equal(expect, actual)
|
263
|
+
end
|
264
|
+
|
265
|
+
def test_each_at_strategy_with_optimization_max_with_numeric_negative
|
266
|
+
filter = [-1] # Note: must be wrapped in an array because then strategy presumes filter#each.
|
267
|
+
expect = ["f"]
|
268
|
+
actual = []
|
269
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
270
|
+
assert_equal(expect, actual)
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_each_at_strategy_with_optimization_max_with_enumerable_positives_asendining
|
274
|
+
filter = [1, 2]
|
275
|
+
expect = ["b", "c"]
|
276
|
+
actual = []
|
277
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
278
|
+
assert_equal(expect, actual)
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_each_at_strategy_with_optimization_max_with_enumerable_positives_descending
|
282
|
+
filter = [2, 1]
|
283
|
+
expect = ["c", "b"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
284
|
+
actual = []
|
285
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
286
|
+
assert_equal(expect, actual)
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_each_at_strategy_with_optimization_max_with_enumerable_negatives_ascending
|
290
|
+
filter = [-2, -1]
|
291
|
+
expect = ["e", "f"]
|
292
|
+
actual = []
|
293
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
294
|
+
assert_equal(expect, actual)
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_each_at_strategy_with_optimization_max_with_enumerable_negatives_descending
|
298
|
+
filter = [-1, -2]
|
299
|
+
expect = ["f", "e"] # Note: order depends on filter, not LIST, because the strategy uses filter#each.
|
300
|
+
actual = []
|
301
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
302
|
+
assert_equal(expect, actual)
|
303
|
+
end
|
304
|
+
|
305
|
+
def test_each_at_strategy_with_optimization_max_with_range_positives_ascending
|
306
|
+
filter = 1..2
|
307
|
+
expect = ["b", "c"]
|
308
|
+
actual = []
|
309
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
310
|
+
assert_equal(expect, actual)
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_each_at_strategy_with_optimization_max_with_range_positives_descending
|
314
|
+
filter = 2..1
|
315
|
+
expect = [] # Degenerate because filter#each will noop.
|
316
|
+
actual = []
|
317
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
318
|
+
assert_equal(expect, actual)
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_each_at_strategy_with_optimization_max_with_range_negatives_ascending
|
322
|
+
filter = -2..-1
|
323
|
+
expect = ["e", "f"]
|
324
|
+
actual = []
|
325
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
326
|
+
assert_equal(expect, actual)
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_each_at_strategy_with_optimization_max_with_range_negatives_descending
|
330
|
+
filter = -1..-2
|
331
|
+
expect = [] # Degenerate because filter#each will noop.
|
332
|
+
actual = []
|
333
|
+
LIST.each_at_strategy_with_optimization_max(filter){|o| actual << o}
|
334
|
+
assert_equal(expect, actual)
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
@@ -1,17 +1,15 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/file"
|
4
4
|
|
5
|
-
|
6
|
-
class FileTestCase < Minitest::Test
|
5
|
+
class FileTestClass < Minitest::Test
|
7
6
|
|
8
7
|
def test_load_dir_files
|
9
8
|
filename='/a/b/c.d'
|
10
9
|
dirname=File.dirname(filename)
|
11
|
-
expect=File.join(dirname,'x','y','z')
|
10
|
+
expect=File.join(dirname,'x','y','z')
|
12
11
|
actual=File.joindir(filename,'x','y','z')
|
13
12
|
assert_equal(expect,actual,"filename:#{filename} dirname:#{dirname}")
|
14
13
|
end
|
15
14
|
|
16
15
|
end
|
17
|
-
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
4
|
-
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/fixnum"
|
5
4
|
|
6
5
|
class FixnumTest < Minitest::Test
|
7
6
|
|
@@ -22,4 +21,3 @@ class FixnumTest < Minitest::Test
|
|
22
21
|
end
|
23
22
|
|
24
23
|
end
|
25
|
-
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
4
|
-
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/integer"
|
5
4
|
|
6
5
|
class IntegerTest < Minitest::Test
|
7
6
|
|
@@ -12,8 +11,8 @@ class IntegerTest < Minitest::Test
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_maps_with_index
|
15
|
-
expect=[0,
|
16
|
-
actual=3.maps{|i| i}
|
14
|
+
expect=[0,2,4]
|
15
|
+
actual=3.maps{|i| i * 2}
|
17
16
|
assert_equal(expect,actual)
|
18
17
|
end
|
19
18
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/kernel"
|
4
4
|
|
5
5
|
class KernelTest < Minitest::Test
|
6
6
|
|
7
7
|
class TestMyMethodName
|
8
8
|
def a
|
9
|
-
my_method_name
|
9
|
+
my_method_name
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -18,7 +18,7 @@ class KernelTest < Minitest::Test
|
|
18
18
|
|
19
19
|
class TestCallerMethodNameWithIndex0
|
20
20
|
def a
|
21
|
-
caller_method_name(0)
|
21
|
+
caller_method_name(0)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -27,7 +27,7 @@ class KernelTest < Minitest::Test
|
|
27
27
|
b
|
28
28
|
end
|
29
29
|
def b
|
30
|
-
caller_method_name(1)
|
30
|
+
caller_method_name(1)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -52,4 +52,3 @@ class KernelTest < Minitest::Test
|
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
55
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/math"
|
4
4
|
|
5
5
|
class MathTest < Minitest::Test
|
6
6
|
|
@@ -16,4 +16,3 @@ class MathTest < Minitest::Test
|
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
19
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/object"
|
4
4
|
|
5
5
|
class ObjectTest < Minitest::Test
|
6
6
|
|
@@ -10,4 +10,3 @@ class ObjectTest < Minitest::Test
|
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
13
|
-
|
@@ -1,51 +1,41 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require "
|
3
|
-
require "sixarm_ruby_ramp"
|
4
|
-
|
2
|
+
require "sixarm_ruby_ramp_test"
|
3
|
+
require "sixarm_ruby_ramp/string"
|
5
4
|
|
6
5
|
class StringTest < Minitest::Test
|
7
6
|
|
8
|
-
|
9
7
|
def test_capitalize_words
|
10
8
|
assert_equal("Foo Goo Hoo","foo goo hoo".capitalize_words)
|
11
9
|
end
|
12
10
|
|
13
|
-
|
14
11
|
def test_words
|
15
12
|
assert_equal(['foo','goo','hoo'],"foo goo hoo".words)
|
16
13
|
end
|
17
14
|
|
18
|
-
|
19
15
|
def test_split_tab
|
20
16
|
assert_equal(['foo','goo','hoo'],"foo\tgoo\thoo".split_tab)
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
19
|
def test_split_tsv
|
25
20
|
assert_equal([['a','b','c'],['d','e','f'],['g','h','i']],"a\tb\tc\nd\te\tf\ng\th\ti".split_tsv)
|
26
21
|
end
|
27
22
|
|
28
|
-
|
29
23
|
def test_xid
|
30
24
|
assert_equal('foo_goo_hoo',"Foo GOO**_**Hoo".to_xid)
|
31
25
|
end
|
32
26
|
|
33
|
-
|
34
27
|
def test_lowcase
|
35
28
|
assert_equal('foo_goo_hoo',"Foo GOO**_**Hoo".lowcase)
|
36
29
|
end
|
37
30
|
|
38
|
-
|
39
31
|
def test_to_class
|
40
32
|
assert_equal(String,'String'.to_class)
|
41
33
|
end
|
42
34
|
|
43
|
-
|
44
35
|
def test_to_class_nested
|
45
36
|
assert_equal(FooModule::FooClass,'FooModule::FooClass'.to_class)
|
46
37
|
end
|
47
38
|
|
48
|
-
|
49
39
|
def test_increment
|
50
40
|
assert_equal('5','4'.increment, 'number is entire string')
|
51
41
|
assert_equal('5foo','4foo'.increment, 'number is leftmost')
|
@@ -55,7 +45,6 @@ class StringTest < Minitest::Test
|
|
55
45
|
assert_equal('foobar','foobar'.increment, 'no number, so should be unchanged')
|
56
46
|
end
|
57
47
|
|
58
|
-
|
59
48
|
def test_decrement
|
60
49
|
assert_equal('3','4'.decrement, 'number is entire string')
|
61
50
|
assert_equal('3foo','4foo'.decrement, 'number is leftmost')
|
@@ -65,7 +54,6 @@ class StringTest < Minitest::Test
|
|
65
54
|
assert_equal('foobar','foobar'.decrement, 'no number, so should be unchanged')
|
66
55
|
end
|
67
56
|
|
68
|
-
|
69
57
|
def test_prev_char
|
70
58
|
assert_equal(["-",false,false] ,String.prev_char("-")) #unchanged
|
71
59
|
assert_equal(["5",true,false] ,String.prev_char("6")) #numeric typical
|
@@ -76,7 +64,6 @@ class StringTest < Minitest::Test
|
|
76
64
|
assert_equal(["Z",true,true] ,String.prev_char("A")) #uppercase carry
|
77
65
|
end
|
78
66
|
|
79
|
-
|
80
67
|
def test_prev
|
81
68
|
assert_equal('n-','n-'.prev) # unchanged
|
82
69
|
assert_equal('n5','n6'.prev) # numeric typical
|
@@ -112,20 +99,8 @@ class StringTest < Minitest::Test
|
|
112
99
|
|
113
100
|
end
|
114
101
|
|
115
|
-
|
116
102
|
# For testing #to_class
|
117
103
|
module FooModule #:nodoc: all
|
118
104
|
class FooClass
|
119
105
|
end
|
120
106
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|