tbpgr_utils 0.0.36 → 0.0.37
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/README.md +40 -1
- data/lib/open_classes/array/together.rb +23 -0
- data/lib/open_classes/array/together_at.rb +29 -0
- data/lib/open_classes/array/together_clear.rb +24 -0
- data/lib/open_classes/array/together_compact.rb +44 -0
- data/lib/open_classes/array/together_concat.rb +25 -0
- data/lib/open_classes/array/together_delete.rb +46 -0
- data/lib/open_classes/array/together_delete_at.rb +43 -0
- data/lib/open_classes/array/together_delete_if.rb +38 -0
- data/lib/open_classes/array/together_empty.rb +31 -0
- data/lib/open_classes/array/together_fill.rb +43 -0
- data/lib/open_classes/array/together_first.rb +40 -0
- data/lib/open_classes/array/together_helper.rb +25 -0
- data/lib/open_classes/array/together_include.rb +50 -0
- data/lib/open_classes/array/together_index.rb +34 -0
- data/lib/open_classes/array/together_insert.rb +34 -0
- data/lib/open_classes/array/together_last.rb +40 -0
- data/lib/open_classes/array/together_map.rb +87 -0
- data/lib/open_classes/array/together_pop.rb +47 -0
- data/lib/open_classes/array/together_reduce.rb +59 -0
- data/lib/open_classes/array/together_reverse.rb +53 -0
- data/lib/open_classes/array/together_sample.rb +49 -0
- data/lib/open_classes/array/together_select.rb +50 -0
- data/lib/open_classes/array/together_shift.rb +47 -0
- data/lib/open_classes/array/together_with_index.rb +24 -0
- data/lib/open_classes/array.rb +23 -718
- data/lib/tbpgr_utils/version.rb +1 -1
- data/spec/open_classes/array/together_at_spec.rb +61 -0
- data/spec/open_classes/array/together_clear_spec.rb +51 -0
- data/spec/open_classes/array/together_compact_spec.rb +103 -0
- data/spec/open_classes/array/together_concat_spec.rb +53 -0
- data/spec/open_classes/array/together_delete_at_spec.rb +78 -0
- data/spec/open_classes/array/together_delete_if_spec.rb +61 -0
- data/spec/open_classes/array/together_delete_spec.rb +80 -0
- data/spec/open_classes/array/together_empty_spec.rb +58 -0
- data/spec/open_classes/array/together_fill_spec.rb +79 -0
- data/spec/open_classes/array/together_first_spec.rb +84 -0
- data/spec/open_classes/array/together_include_spec.rb +100 -0
- data/spec/open_classes/array/together_index_spec.rb +69 -0
- data/spec/open_classes/array/together_insert_spec.rb +65 -0
- data/spec/open_classes/array/together_last_spec.rb +84 -0
- data/spec/open_classes/array/together_map_spec.rb +171 -0
- data/spec/open_classes/array/together_pop_spec.rb +105 -0
- data/spec/open_classes/array/together_reduce_spec.rb +100 -0
- data/spec/open_classes/array/together_reverse_spec.rb +119 -0
- data/spec/open_classes/array/together_select_spec.rb +76 -0
- data/spec/open_classes/array/together_shift_spec.rb +105 -0
- data/spec/open_classes/array/together_spec.rb +51 -0
- data/spec/open_classes/array/together_with_index_spec.rb +51 -0
- data/spec/open_classes/together_sample_spec.rb +122 -0
- data/spec/spec_helper.rb +1 -1
- metadata +82 -14
- data/spec/open_classes/array_spec.rb +0 -1699
@@ -1,1699 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'tbpgr_utils'
|
4
|
-
|
5
|
-
describe Array do
|
6
|
-
context :together do
|
7
|
-
cases = [
|
8
|
-
{
|
9
|
-
case_no: 1,
|
10
|
-
case_title: 'valid case',
|
11
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
12
|
-
expected: ['1:one', '2:two', '3:three'],
|
13
|
-
},
|
14
|
-
{
|
15
|
-
case_no: 2,
|
16
|
-
case_title: 'contain nil case',
|
17
|
-
inputs: [[1, 2, 3], %w{one two}],
|
18
|
-
expected: ['1:one', '2:two', '3:'],
|
19
|
-
},
|
20
|
-
]
|
21
|
-
|
22
|
-
cases.each do |c|
|
23
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
24
|
-
begin
|
25
|
-
case_before c
|
26
|
-
|
27
|
-
# -- given --
|
28
|
-
# nothing
|
29
|
-
|
30
|
-
# -- when/then --
|
31
|
-
actual = []
|
32
|
-
c[:inputs].together do |first, second|
|
33
|
-
actual << "#{first}:#{second}"
|
34
|
-
end
|
35
|
-
|
36
|
-
expect(actual).to eq(c[:expected])
|
37
|
-
ensure
|
38
|
-
case_after c
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def case_before(c)
|
43
|
-
# implement each case before
|
44
|
-
end
|
45
|
-
|
46
|
-
def case_after(c)
|
47
|
-
# implement each case after
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context :together_with_index do
|
53
|
-
cases = [
|
54
|
-
{
|
55
|
-
case_no: 1,
|
56
|
-
case_title: 'valid case',
|
57
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
58
|
-
expected: ['0:1:one', '1:2:two', '2:3:three'],
|
59
|
-
},
|
60
|
-
{
|
61
|
-
case_no: 2,
|
62
|
-
case_title: 'contain nil case',
|
63
|
-
inputs: [[1, 2, 3], %w{one two}],
|
64
|
-
expected: ['0:1:one', '1:2:two', '2:3:'],
|
65
|
-
},
|
66
|
-
]
|
67
|
-
|
68
|
-
cases.each do |c|
|
69
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
70
|
-
begin
|
71
|
-
case_before c
|
72
|
-
|
73
|
-
# -- given --
|
74
|
-
# nothing
|
75
|
-
|
76
|
-
# -- when/then --
|
77
|
-
actual = []
|
78
|
-
c[:inputs].together_with_index do |first, second, index|
|
79
|
-
actual << "#{index.to_s}:#{first}:#{second}"
|
80
|
-
end
|
81
|
-
|
82
|
-
expect(actual).to eq(c[:expected])
|
83
|
-
ensure
|
84
|
-
case_after c
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def case_before(c)
|
89
|
-
# implement each case before
|
90
|
-
end
|
91
|
-
|
92
|
-
def case_after(c)
|
93
|
-
# implement each case after
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context :together_map do
|
99
|
-
cases = [
|
100
|
-
{
|
101
|
-
case_no: 1,
|
102
|
-
case_title: 'valid case',
|
103
|
-
method_name: :together_map,
|
104
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
105
|
-
expected: ['1:one', '2:two', '3:three'],
|
106
|
-
},
|
107
|
-
{
|
108
|
-
case_no: 2,
|
109
|
-
case_title: 'contain nil case',
|
110
|
-
method_name: :together_map,
|
111
|
-
inputs: [[1, 2, 3], %w{one two}],
|
112
|
-
expected: ['1:one', '2:two', '3:'],
|
113
|
-
},
|
114
|
-
{
|
115
|
-
case_no: 3,
|
116
|
-
case_title: 'valid case',
|
117
|
-
method_name: :together_map,
|
118
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
119
|
-
expected: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
120
|
-
is_multi: true,
|
121
|
-
},
|
122
|
-
{
|
123
|
-
case_no: 4,
|
124
|
-
case_title: 'valid case(alias together_collect)',
|
125
|
-
method_name: :together_collect,
|
126
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
127
|
-
expected: ['1:one', '2:two', '3:three'],
|
128
|
-
},
|
129
|
-
{
|
130
|
-
case_no: 5,
|
131
|
-
case_title: 'valid case(alias tmap)',
|
132
|
-
method_name: :tmap,
|
133
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
134
|
-
expected: ['1:one', '2:two', '3:three'],
|
135
|
-
},
|
136
|
-
{
|
137
|
-
case_no: 6,
|
138
|
-
case_title: 'valid case(alias tcollect)',
|
139
|
-
method_name: :tcollect,
|
140
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
141
|
-
expected: ['1:one', '2:two', '3:three'],
|
142
|
-
},
|
143
|
-
]
|
144
|
-
|
145
|
-
cases.each do |c|
|
146
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
147
|
-
begin
|
148
|
-
case_before c
|
149
|
-
|
150
|
-
# -- given --
|
151
|
-
# nothing
|
152
|
-
|
153
|
-
# -- when/then --
|
154
|
-
if c[:is_multi]
|
155
|
-
actual = c[:inputs].method(c[:method_name]).call { |first, second|["#{first}:#{second}", "#{second}:#{first}"] }
|
156
|
-
else
|
157
|
-
actual = c[:inputs].method(c[:method_name]).call { |first, second|"#{first}:#{second}" }
|
158
|
-
end
|
159
|
-
|
160
|
-
expect(actual).to eq(c[:expected])
|
161
|
-
ensure
|
162
|
-
case_after c
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def case_before(c)
|
167
|
-
# implement each case before
|
168
|
-
end
|
169
|
-
|
170
|
-
def case_after(c)
|
171
|
-
# implement each case after
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
context :together_map! do
|
177
|
-
cases = [
|
178
|
-
{
|
179
|
-
case_no: 1,
|
180
|
-
case_title: 'valid case',
|
181
|
-
method_name: :together_map!,
|
182
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
183
|
-
expected_ret: ['1:one', '2:two', '3:three'],
|
184
|
-
expected_self: ['1:one', '2:two', '3:three'],
|
185
|
-
},
|
186
|
-
{
|
187
|
-
case_no: 2,
|
188
|
-
case_title: 'contain nil case',
|
189
|
-
method_name: :together_map!,
|
190
|
-
inputs: [[1, 2, 3], %w{one two}],
|
191
|
-
expected_ret: ['1:one', '2:two', '3:'],
|
192
|
-
expected_self: ['1:one', '2:two', '3:'],
|
193
|
-
},
|
194
|
-
{
|
195
|
-
case_no: 3,
|
196
|
-
case_title: 'valid case',
|
197
|
-
method_name: :together_map!,
|
198
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
199
|
-
expected_ret: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
200
|
-
expected_self: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
201
|
-
is_multi: true,
|
202
|
-
},
|
203
|
-
{
|
204
|
-
case_no: 4,
|
205
|
-
case_title: 'valid case(alias together_collect!)',
|
206
|
-
method_name: :together_collect!,
|
207
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
208
|
-
expected_ret: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
209
|
-
expected_self: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
210
|
-
is_multi: true,
|
211
|
-
},
|
212
|
-
{
|
213
|
-
case_no: 5,
|
214
|
-
case_title: 'valid case(alias tmap!)',
|
215
|
-
method_name: :tmap!,
|
216
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
217
|
-
expected_ret: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
218
|
-
expected_self: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
219
|
-
is_multi: true,
|
220
|
-
},
|
221
|
-
{
|
222
|
-
case_no: 6,
|
223
|
-
case_title: 'valid case(alias tcollect!)',
|
224
|
-
method_name: :tcollect!,
|
225
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
226
|
-
expected_ret: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
227
|
-
expected_self: [['1:one', '2:two', '3:three'], ['one:1', 'two:2', 'three:3']],
|
228
|
-
is_multi: true,
|
229
|
-
},
|
230
|
-
]
|
231
|
-
|
232
|
-
cases.each do |c|
|
233
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
234
|
-
begin
|
235
|
-
case_before c
|
236
|
-
|
237
|
-
# -- given --
|
238
|
-
# nothing
|
239
|
-
|
240
|
-
# -- when/then --
|
241
|
-
if c[:is_multi]
|
242
|
-
actual = c[:inputs].method(c[:method_name]).call { |first, second|["#{first}:#{second}", "#{second}:#{first}"] }
|
243
|
-
else
|
244
|
-
actual = c[:inputs].method(c[:method_name]).call { |first, second|"#{first}:#{second}" }
|
245
|
-
end
|
246
|
-
|
247
|
-
expect(actual).to eq(c[:expected_ret])
|
248
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
249
|
-
ensure
|
250
|
-
case_after c
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
def case_before(c)
|
255
|
-
# implement each case before
|
256
|
-
end
|
257
|
-
|
258
|
-
def case_after(c)
|
259
|
-
# implement each case after
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
context :together_select do
|
265
|
-
cases = [
|
266
|
-
{
|
267
|
-
case_no: 1,
|
268
|
-
case_title: 'single valid case',
|
269
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
270
|
-
condition: 'first == second',
|
271
|
-
method_name: :together_select,
|
272
|
-
expected: [[2, 3], [2, 3]],
|
273
|
-
},
|
274
|
-
{
|
275
|
-
case_no: 2,
|
276
|
-
case_title: 'multi valid case',
|
277
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
278
|
-
condition: '[first.odd?, second.even?]',
|
279
|
-
expected: [[1, 3], [4, 2]],
|
280
|
-
method_name: :together_select,
|
281
|
-
},
|
282
|
-
{
|
283
|
-
case_no: 3,
|
284
|
-
case_title: 'multi valid case',
|
285
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
286
|
-
condition: '[first.odd?, second.even?]',
|
287
|
-
expected: [[1, 3], [4, 2]],
|
288
|
-
method_name: :tselect,
|
289
|
-
},
|
290
|
-
{
|
291
|
-
case_no: 4,
|
292
|
-
case_title: 'multi valid case',
|
293
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
294
|
-
condition: '[first.odd?, second.even?]',
|
295
|
-
expected: [[1, 3], [4, 2]],
|
296
|
-
method_name: :together_find_all,
|
297
|
-
},
|
298
|
-
{
|
299
|
-
case_no: 5,
|
300
|
-
case_title: 'multi valid case',
|
301
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
302
|
-
condition: '[first.odd?, second.even?]',
|
303
|
-
expected: [[1, 3], [4, 2]],
|
304
|
-
method_name: :tfindall,
|
305
|
-
},
|
306
|
-
]
|
307
|
-
|
308
|
-
cases.each do |c|
|
309
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
310
|
-
begin
|
311
|
-
case_before c
|
312
|
-
|
313
|
-
# -- given --
|
314
|
-
# nothing
|
315
|
-
|
316
|
-
# -- when/then --
|
317
|
-
actual = c[:inputs].method(c[:method_name]).call { |first, second| eval c[:condition], binding }
|
318
|
-
|
319
|
-
expect(actual).to eq(c[:expected])
|
320
|
-
ensure
|
321
|
-
case_after c
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
def case_before(c)
|
326
|
-
# implement each case before
|
327
|
-
end
|
328
|
-
|
329
|
-
def case_after(c)
|
330
|
-
# implement each case after
|
331
|
-
end
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
context :together_reduce do
|
336
|
-
cases = [
|
337
|
-
{
|
338
|
-
case_no: 1,
|
339
|
-
case_title: 'single valid case',
|
340
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
341
|
-
init: nil,
|
342
|
-
logic: 'memo + first + second',
|
343
|
-
method_name: :together_reduce,
|
344
|
-
expected: 20,
|
345
|
-
},
|
346
|
-
{
|
347
|
-
case_no: 2,
|
348
|
-
case_title: 'single with init valid case',
|
349
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
350
|
-
init: 10,
|
351
|
-
logic: 'memo + first + second',
|
352
|
-
method_name: :together_reduce,
|
353
|
-
expected: 30,
|
354
|
-
},
|
355
|
-
{
|
356
|
-
case_no: 5,
|
357
|
-
case_title: 'single valid case',
|
358
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
359
|
-
logic: 'memo + first + second',
|
360
|
-
expected: 20,
|
361
|
-
method_name: :treduce,
|
362
|
-
},
|
363
|
-
{
|
364
|
-
case_no: 6,
|
365
|
-
case_title: 'single valid case',
|
366
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
367
|
-
logic: 'memo + first + second',
|
368
|
-
expected: 20,
|
369
|
-
method_name: :together_inject,
|
370
|
-
},
|
371
|
-
{
|
372
|
-
case_no: 7,
|
373
|
-
case_title: 'multi valid case',
|
374
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
375
|
-
logic: 'memo + first + second',
|
376
|
-
expected: 20,
|
377
|
-
method_name: :tinject,
|
378
|
-
},
|
379
|
-
{
|
380
|
-
case_no: 8,
|
381
|
-
case_title: 'single with init valid array case',
|
382
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
383
|
-
init: [],
|
384
|
-
logic: 'memo << first + second',
|
385
|
-
method_name: :together_reduce,
|
386
|
-
expected: [5, 4, 6, 5],
|
387
|
-
},
|
388
|
-
{
|
389
|
-
case_no: 9,
|
390
|
-
case_title: 'single with init valid array case',
|
391
|
-
inputs: [[1, 2, 3, 4], [4, 2, 3, 1]],
|
392
|
-
init: {},
|
393
|
-
logic: 'memo[first] = second; memo',
|
394
|
-
method_name: :together_reduce,
|
395
|
-
expected: { 1 => 4, 2 => 2, 3 => 3, 4 => 1 },
|
396
|
-
},
|
397
|
-
]
|
398
|
-
|
399
|
-
cases.each do |c|
|
400
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
401
|
-
begin
|
402
|
-
case_before c
|
403
|
-
|
404
|
-
# -- given --
|
405
|
-
# nothing
|
406
|
-
|
407
|
-
# -- when/then --
|
408
|
-
if c[:init]
|
409
|
-
actual = c[:inputs].method(c[:method_name]).call(c[:init]) { |memo, first, second| eval c[:logic], binding }
|
410
|
-
else
|
411
|
-
actual = c[:inputs].method(c[:method_name]).call { |memo, first, second| eval c[:logic], binding }
|
412
|
-
end
|
413
|
-
|
414
|
-
expect(actual).to eq(c[:expected])
|
415
|
-
ensure
|
416
|
-
case_after c
|
417
|
-
end
|
418
|
-
end
|
419
|
-
|
420
|
-
def case_before(c)
|
421
|
-
# implement each case before
|
422
|
-
end
|
423
|
-
|
424
|
-
def case_after(c)
|
425
|
-
# implement each case after
|
426
|
-
end
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
context :together_concat do
|
431
|
-
cases = [
|
432
|
-
{
|
433
|
-
case_no: 1,
|
434
|
-
case_title: 'valid case',
|
435
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
436
|
-
add_list: [4, 5, 6],
|
437
|
-
method_name: :together_concat,
|
438
|
-
expected: [[1, 2, 3, 4, 5, 6], ['one', 'two', 'three', 4, 5, 6]],
|
439
|
-
},
|
440
|
-
{
|
441
|
-
case_no: 2,
|
442
|
-
case_title: 'valid case',
|
443
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
444
|
-
add_list: [4, 5, 6],
|
445
|
-
method_name: :tconcat,
|
446
|
-
expected: [[1, 2, 3, 4, 5, 6], ['one', 'two', 'three', 4, 5, 6]],
|
447
|
-
},
|
448
|
-
]
|
449
|
-
|
450
|
-
cases.each do |c|
|
451
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
452
|
-
begin
|
453
|
-
case_before c
|
454
|
-
|
455
|
-
# -- given --
|
456
|
-
# nothing
|
457
|
-
|
458
|
-
# -- when --
|
459
|
-
c[:inputs].send c[:method_name], c[:add_list]
|
460
|
-
|
461
|
-
# -- then --
|
462
|
-
expect(c[:inputs]).to eq(c[:expected])
|
463
|
-
ensure
|
464
|
-
case_after c
|
465
|
-
end
|
466
|
-
end
|
467
|
-
|
468
|
-
def case_before(c)
|
469
|
-
# implement each case before
|
470
|
-
end
|
471
|
-
|
472
|
-
def case_after(c)
|
473
|
-
# implement each case after
|
474
|
-
end
|
475
|
-
end
|
476
|
-
end
|
477
|
-
|
478
|
-
context :together_at do
|
479
|
-
cases = [
|
480
|
-
{
|
481
|
-
case_no: 1,
|
482
|
-
case_title: 'valid case',
|
483
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
484
|
-
index: 2,
|
485
|
-
method_name: :together_at,
|
486
|
-
expected: [3, 'three'],
|
487
|
-
},
|
488
|
-
{
|
489
|
-
case_no: 2,
|
490
|
-
case_title: 'contain nil case',
|
491
|
-
inputs: [[1, 2, 3], %w{one two}],
|
492
|
-
index: 2,
|
493
|
-
method_name: :together_at,
|
494
|
-
expected: [3, nil],
|
495
|
-
},
|
496
|
-
{
|
497
|
-
case_no: 3,
|
498
|
-
case_title: 'valid case',
|
499
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
500
|
-
index: 2,
|
501
|
-
method_name: :tat,
|
502
|
-
expected: [3, 'three'],
|
503
|
-
},
|
504
|
-
]
|
505
|
-
|
506
|
-
cases.each do |c|
|
507
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
508
|
-
begin
|
509
|
-
case_before c
|
510
|
-
|
511
|
-
# -- given --
|
512
|
-
# nothing
|
513
|
-
|
514
|
-
# -- when --
|
515
|
-
actual = c[:inputs].send c[:method_name], c[:index]
|
516
|
-
|
517
|
-
# -- then --
|
518
|
-
expect(actual).to eq(c[:expected])
|
519
|
-
ensure
|
520
|
-
case_after c
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
def case_before(c)
|
525
|
-
# implement each case before
|
526
|
-
end
|
527
|
-
|
528
|
-
def case_after(c)
|
529
|
-
# implement each case after
|
530
|
-
end
|
531
|
-
end
|
532
|
-
end
|
533
|
-
|
534
|
-
context :together_clear do
|
535
|
-
cases = [
|
536
|
-
{
|
537
|
-
case_no: 1,
|
538
|
-
case_title: 'valid case',
|
539
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
540
|
-
method_name: :together_clear,
|
541
|
-
expected: [[], []],
|
542
|
-
},
|
543
|
-
{
|
544
|
-
case_no: 2,
|
545
|
-
case_title: 'valid case',
|
546
|
-
inputs: [[1, 2, 3], %w{one two three}],
|
547
|
-
method_name: :tclear,
|
548
|
-
expected: [[], []],
|
549
|
-
},
|
550
|
-
]
|
551
|
-
|
552
|
-
cases.each do |c|
|
553
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
554
|
-
begin
|
555
|
-
case_before c
|
556
|
-
|
557
|
-
# -- given --
|
558
|
-
# nothing
|
559
|
-
|
560
|
-
# -- when --
|
561
|
-
actual = c[:inputs].send c[:method_name]
|
562
|
-
|
563
|
-
# -- then --
|
564
|
-
expect(actual).to eq(c[:expected])
|
565
|
-
ensure
|
566
|
-
case_after c
|
567
|
-
end
|
568
|
-
end
|
569
|
-
|
570
|
-
def case_before(c)
|
571
|
-
# implement each case before
|
572
|
-
end
|
573
|
-
|
574
|
-
def case_after(c)
|
575
|
-
# implement each case after
|
576
|
-
end
|
577
|
-
end
|
578
|
-
end
|
579
|
-
|
580
|
-
context :together_compact do
|
581
|
-
cases = [
|
582
|
-
{
|
583
|
-
case_no: 1,
|
584
|
-
case_title: 'valid case',
|
585
|
-
inputs: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
586
|
-
method_name: :together_compact,
|
587
|
-
expected_self: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
588
|
-
expected_ret: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
589
|
-
},
|
590
|
-
{
|
591
|
-
case_no: 2,
|
592
|
-
case_title: 'valid case(use alias tcompact)',
|
593
|
-
inputs: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
594
|
-
method_name: :tcompact,
|
595
|
-
expected_self: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
596
|
-
expected_ret: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
597
|
-
},
|
598
|
-
]
|
599
|
-
|
600
|
-
cases.each do |c|
|
601
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
602
|
-
begin
|
603
|
-
case_before c
|
604
|
-
|
605
|
-
# -- given --
|
606
|
-
# nothing
|
607
|
-
|
608
|
-
# -- when --
|
609
|
-
actual = c[:inputs].send c[:method_name]
|
610
|
-
|
611
|
-
# -- then --
|
612
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
613
|
-
expect(actual).to eq(c[:expected_ret])
|
614
|
-
ensure
|
615
|
-
case_after c
|
616
|
-
end
|
617
|
-
end
|
618
|
-
|
619
|
-
def case_before(c)
|
620
|
-
# implement each case before
|
621
|
-
end
|
622
|
-
|
623
|
-
def case_after(c)
|
624
|
-
# implement each case after
|
625
|
-
end
|
626
|
-
end
|
627
|
-
end
|
628
|
-
|
629
|
-
context :together_compact! do
|
630
|
-
cases = [
|
631
|
-
{
|
632
|
-
case_no: 1,
|
633
|
-
case_title: 'valid case',
|
634
|
-
inputs: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
635
|
-
method_name: :together_compact!,
|
636
|
-
expected_self: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
637
|
-
expected_ret: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
638
|
-
},
|
639
|
-
{
|
640
|
-
case_no: 2,
|
641
|
-
case_title: 'valid case(use alias tcompact)',
|
642
|
-
inputs: [[1, 2, nil, 3], ['a', 'b', 'c', nil, 'd']],
|
643
|
-
method_name: :tcompact!,
|
644
|
-
expected_self: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
645
|
-
expected_ret: [[1, 2, 3], ['a', 'b', 'c', 'd']],
|
646
|
-
},
|
647
|
-
]
|
648
|
-
|
649
|
-
cases.each do |c|
|
650
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
651
|
-
begin
|
652
|
-
case_before c
|
653
|
-
|
654
|
-
# -- given --
|
655
|
-
# nothing
|
656
|
-
|
657
|
-
# -- when --
|
658
|
-
actual = c[:inputs].send c[:method_name]
|
659
|
-
|
660
|
-
# -- then --
|
661
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
662
|
-
expect(actual).to eq(c[:expected_ret])
|
663
|
-
ensure
|
664
|
-
case_after c
|
665
|
-
end
|
666
|
-
end
|
667
|
-
|
668
|
-
def case_before(c)
|
669
|
-
# implement each case before
|
670
|
-
end
|
671
|
-
|
672
|
-
def case_after(c)
|
673
|
-
# implement each case after
|
674
|
-
end
|
675
|
-
end
|
676
|
-
end
|
677
|
-
|
678
|
-
context :together_delete do
|
679
|
-
cases = [
|
680
|
-
{
|
681
|
-
case_no: 1,
|
682
|
-
case_title: 'valid case',
|
683
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
684
|
-
delete_value: 2,
|
685
|
-
method_name: :together_delete,
|
686
|
-
expected: [[1, 3, 4], [3, 4, 5]],
|
687
|
-
ret: 2,
|
688
|
-
},
|
689
|
-
{
|
690
|
-
case_no: 2,
|
691
|
-
case_title: 'valid case(not exist and block use)',
|
692
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
693
|
-
delete_value: 6,
|
694
|
-
method_name: :together_delete,
|
695
|
-
expected: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
696
|
-
ret: :ret,
|
697
|
-
has_block: true,
|
698
|
-
block: :ret,
|
699
|
-
},
|
700
|
-
{
|
701
|
-
case_no: 3,
|
702
|
-
case_title: 'valid case(not exist and block unuse)',
|
703
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
704
|
-
delete_value: 6,
|
705
|
-
method_name: :together_delete,
|
706
|
-
expected: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
707
|
-
ret: nil,
|
708
|
-
},
|
709
|
-
{
|
710
|
-
case_no: 4,
|
711
|
-
case_title: 'valid case(alias tdelete)',
|
712
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
713
|
-
delete_value: 2,
|
714
|
-
method_name: :tdelete,
|
715
|
-
expected: [[1, 3, 4], [3, 4, 5]],
|
716
|
-
ret: 2,
|
717
|
-
},
|
718
|
-
]
|
719
|
-
|
720
|
-
cases.each do |c|
|
721
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
722
|
-
begin
|
723
|
-
case_before c
|
724
|
-
|
725
|
-
# -- given --
|
726
|
-
# nothing
|
727
|
-
|
728
|
-
# -- when --
|
729
|
-
if c[:has_block]
|
730
|
-
actual = c[:inputs].send c[:method_name], c[:delete_value] {c[:block] }
|
731
|
-
else
|
732
|
-
actual = c[:inputs].send c[:method_name], c[:delete_value]
|
733
|
-
end
|
734
|
-
|
735
|
-
# -- then --
|
736
|
-
expect(actual).to eq(c[:ret])
|
737
|
-
expect(c[:inputs]).to eq(c[:expected])
|
738
|
-
ensure
|
739
|
-
case_after c
|
740
|
-
end
|
741
|
-
end
|
742
|
-
|
743
|
-
def case_before(c)
|
744
|
-
# implement each case before
|
745
|
-
end
|
746
|
-
|
747
|
-
def case_after(c)
|
748
|
-
# implement each case after
|
749
|
-
end
|
750
|
-
end
|
751
|
-
end
|
752
|
-
|
753
|
-
context :together_delete_at do
|
754
|
-
cases = [
|
755
|
-
{
|
756
|
-
case_no: 1,
|
757
|
-
case_title: 'valid case',
|
758
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
759
|
-
delete_value: 2,
|
760
|
-
method_name: :together_delete_at,
|
761
|
-
expected: [[1, 2, 4], [2, 3, 5]],
|
762
|
-
ret: [3, 4],
|
763
|
-
},
|
764
|
-
{
|
765
|
-
case_no: 2,
|
766
|
-
case_title: 'valid case(not exist)',
|
767
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
768
|
-
delete_value: 5,
|
769
|
-
method_name: :together_delete_at,
|
770
|
-
expected: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
771
|
-
ret: [nil, nil],
|
772
|
-
},
|
773
|
-
{
|
774
|
-
case_no: 3,
|
775
|
-
case_title: 'valid case(minus index)',
|
776
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
777
|
-
delete_value: -3,
|
778
|
-
method_name: :together_delete_at,
|
779
|
-
expected: [[1, 3, 4], [2, 4, 5]],
|
780
|
-
ret: [2, 3],
|
781
|
-
},
|
782
|
-
{
|
783
|
-
case_no: 4,
|
784
|
-
case_title: 'valid case(use tdelete_at alias)',
|
785
|
-
inputs: [[1, 2, 3, 4], [2, 3, 4, 5]],
|
786
|
-
delete_value: 2,
|
787
|
-
method_name: :tdelete_at,
|
788
|
-
expected: [[1, 2, 4], [2, 3, 5]],
|
789
|
-
ret: [3, 4],
|
790
|
-
},
|
791
|
-
]
|
792
|
-
|
793
|
-
cases.each do |c|
|
794
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
795
|
-
begin
|
796
|
-
case_before c
|
797
|
-
|
798
|
-
# -- given --
|
799
|
-
# nothing
|
800
|
-
|
801
|
-
# -- when --
|
802
|
-
if c[:has_block]
|
803
|
-
actual = c[:inputs].send c[:method_name], c[:delete_value] {c[:block] }
|
804
|
-
else
|
805
|
-
actual = c[:inputs].send c[:method_name], c[:delete_value]
|
806
|
-
end
|
807
|
-
|
808
|
-
# -- then --
|
809
|
-
expect(actual).to eq(c[:ret])
|
810
|
-
expect(c[:inputs]).to eq(c[:expected])
|
811
|
-
ensure
|
812
|
-
case_after c
|
813
|
-
end
|
814
|
-
end
|
815
|
-
|
816
|
-
def case_before(c)
|
817
|
-
# implement each case before
|
818
|
-
end
|
819
|
-
|
820
|
-
def case_after(c)
|
821
|
-
# implement each case after
|
822
|
-
end
|
823
|
-
end
|
824
|
-
end
|
825
|
-
|
826
|
-
context :together_delete_if do
|
827
|
-
cases = [
|
828
|
-
{
|
829
|
-
case_no: 1,
|
830
|
-
case_title: 'valid case',
|
831
|
-
inputs: [[1, 2, 3, 4], [6, 4, 6, 8]],
|
832
|
-
delete_block_code: '(first + second).odd?',
|
833
|
-
method_name: :together_delete_if,
|
834
|
-
expected: [[2, 4], [4, 8]],
|
835
|
-
},
|
836
|
-
{
|
837
|
-
case_no: 2,
|
838
|
-
case_title: 'not have delete target value case',
|
839
|
-
inputs: [[2, 2, 4, 4], [6, 4, 6, 8]],
|
840
|
-
delete_block_code: '(first + second).odd?',
|
841
|
-
method_name: :together_delete_if,
|
842
|
-
expected: nil,
|
843
|
-
},
|
844
|
-
{
|
845
|
-
case_no: 3,
|
846
|
-
case_title: 'valid case(alias tdelete_if)',
|
847
|
-
inputs: [[1, 2, 3, 4], [6, 4, 6, 8]],
|
848
|
-
delete_block_code: '(first + second).odd?',
|
849
|
-
method_name: :tdelete_if,
|
850
|
-
expected: [[2, 4], [4, 8]],
|
851
|
-
},
|
852
|
-
]
|
853
|
-
|
854
|
-
cases.each do |c|
|
855
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
856
|
-
begin
|
857
|
-
case_before c
|
858
|
-
|
859
|
-
# -- given --
|
860
|
-
# nothing
|
861
|
-
|
862
|
-
# -- when --
|
863
|
-
actual = c[:inputs].send c[:method_name] {|first, second|eval c[:delete_block_code], binding }
|
864
|
-
|
865
|
-
# -- then --
|
866
|
-
expect(actual).to eq(c[:expected])
|
867
|
-
ensure
|
868
|
-
case_after c
|
869
|
-
end
|
870
|
-
end
|
871
|
-
|
872
|
-
def case_before(c)
|
873
|
-
# implement each case before
|
874
|
-
end
|
875
|
-
|
876
|
-
def case_after(c)
|
877
|
-
# implement each case after
|
878
|
-
end
|
879
|
-
end
|
880
|
-
end
|
881
|
-
|
882
|
-
context :together_empty? do
|
883
|
-
cases = [
|
884
|
-
{
|
885
|
-
case_no: 1,
|
886
|
-
case_title: 'empty case',
|
887
|
-
inputs: [[], []],
|
888
|
-
method_name: :together_empty?,
|
889
|
-
expected: true,
|
890
|
-
},
|
891
|
-
{
|
892
|
-
case_no: 2,
|
893
|
-
case_title: 'not empty case',
|
894
|
-
inputs: [[1], []],
|
895
|
-
method_name: :together_empty?,
|
896
|
-
expected: false,
|
897
|
-
},
|
898
|
-
{
|
899
|
-
case_no: 3,
|
900
|
-
case_title: 'empty case(alias tempty?)',
|
901
|
-
inputs: [[], []],
|
902
|
-
method_name: :tempty?,
|
903
|
-
expected: true,
|
904
|
-
},
|
905
|
-
]
|
906
|
-
|
907
|
-
cases.each do |c|
|
908
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
909
|
-
begin
|
910
|
-
case_before c
|
911
|
-
|
912
|
-
# -- given --
|
913
|
-
# nothing
|
914
|
-
|
915
|
-
# -- when --
|
916
|
-
actual = c[:inputs].send c[:method_name]
|
917
|
-
|
918
|
-
# -- then --
|
919
|
-
expect(actual).to eq(c[:expected])
|
920
|
-
ensure
|
921
|
-
case_after c
|
922
|
-
end
|
923
|
-
end
|
924
|
-
|
925
|
-
def case_before(c)
|
926
|
-
# implement each case before
|
927
|
-
end
|
928
|
-
|
929
|
-
def case_after(c)
|
930
|
-
# implement each case after
|
931
|
-
end
|
932
|
-
end
|
933
|
-
end
|
934
|
-
|
935
|
-
context :together_fill do
|
936
|
-
cases = [
|
937
|
-
{
|
938
|
-
case_no: 1,
|
939
|
-
case_title: 'not use block case',
|
940
|
-
inputs: [[*1..5], [*6..10]],
|
941
|
-
fill_value: 99,
|
942
|
-
method_name: :together_fill,
|
943
|
-
expected: [[99, 99, 99, 99, 99], [99, 99, 99, 99, 99]],
|
944
|
-
has_block: false,
|
945
|
-
},
|
946
|
-
{
|
947
|
-
case_no: 2,
|
948
|
-
case_title: 'use block, no args case',
|
949
|
-
inputs: [[*1..5], [*6..10]],
|
950
|
-
fill_value: nil,
|
951
|
-
method_name: :together_fill,
|
952
|
-
expected: [[2, 3, 4, 5, 6], [2, 3, 4, 5, 6]],
|
953
|
-
block_logic: '(i + 1) + 1',
|
954
|
-
has_block: true,
|
955
|
-
},
|
956
|
-
{
|
957
|
-
case_no: 3,
|
958
|
-
case_title: 'use block, has args case',
|
959
|
-
inputs: [[*1..5], [*6..10]],
|
960
|
-
fill_value: 2,
|
961
|
-
method_name: :together_fill,
|
962
|
-
expected: [[1, 2, 4, 5, 6], [6, 7, 4, 5, 6]],
|
963
|
-
block_logic: '(i + 1) + 1',
|
964
|
-
has_block: true,
|
965
|
-
},
|
966
|
-
{
|
967
|
-
case_no: 4,
|
968
|
-
case_title: 'not use block case(alias tfill)',
|
969
|
-
inputs: [[*1..5], [*6..10]],
|
970
|
-
fill_value: 99,
|
971
|
-
method_name: :tfill,
|
972
|
-
expected: [[99, 99, 99, 99, 99], [99, 99, 99, 99, 99]],
|
973
|
-
has_block: false,
|
974
|
-
},
|
975
|
-
]
|
976
|
-
|
977
|
-
cases.each do |c|
|
978
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
979
|
-
begin
|
980
|
-
case_before c
|
981
|
-
|
982
|
-
# -- given --
|
983
|
-
# nothing
|
984
|
-
|
985
|
-
# -- when --
|
986
|
-
if c[:has_block]
|
987
|
-
actual = c[:inputs].send c[:method_name], c[:fill_value] {|i|eval c[:block_logic], binding }
|
988
|
-
else
|
989
|
-
actual = c[:inputs].send c[:method_name], c[:fill_value]
|
990
|
-
end
|
991
|
-
|
992
|
-
# -- then --
|
993
|
-
expect(actual).to eq(c[:expected])
|
994
|
-
ensure
|
995
|
-
case_after c
|
996
|
-
end
|
997
|
-
end
|
998
|
-
|
999
|
-
def case_before(c)
|
1000
|
-
# implement each case before
|
1001
|
-
end
|
1002
|
-
|
1003
|
-
def case_after(c)
|
1004
|
-
# implement each case after
|
1005
|
-
end
|
1006
|
-
end
|
1007
|
-
end
|
1008
|
-
|
1009
|
-
context :together_first do
|
1010
|
-
cases = [
|
1011
|
-
{
|
1012
|
-
case_no: 1,
|
1013
|
-
case_title: 'not args case',
|
1014
|
-
inputs: [[*1..5], [*6..10]],
|
1015
|
-
method_name: :together_first,
|
1016
|
-
expected: [1, 6],
|
1017
|
-
has_args: false,
|
1018
|
-
},
|
1019
|
-
{
|
1020
|
-
case_no: 2,
|
1021
|
-
case_title: 'has args 2 case',
|
1022
|
-
inputs: [[*1..5], [*6..10]],
|
1023
|
-
args: 2,
|
1024
|
-
method_name: :together_first,
|
1025
|
-
expected: [[1, 2], [6, 7]],
|
1026
|
-
has_args: true,
|
1027
|
-
},
|
1028
|
-
{
|
1029
|
-
case_no: 3,
|
1030
|
-
case_title: 'has args 0 case',
|
1031
|
-
inputs: [[*1..5], [*6..10]],
|
1032
|
-
args: 0,
|
1033
|
-
method_name: :together_first,
|
1034
|
-
expected: [[], []],
|
1035
|
-
has_args: true,
|
1036
|
-
},
|
1037
|
-
{
|
1038
|
-
case_no: 4,
|
1039
|
-
case_title: 'has args over size case',
|
1040
|
-
inputs: [[*1..5], [*6..10]],
|
1041
|
-
args: 6,
|
1042
|
-
method_name: :together_first,
|
1043
|
-
expected: [[*1..5], [*6..10]],
|
1044
|
-
has_args: true,
|
1045
|
-
},
|
1046
|
-
{
|
1047
|
-
case_no: 5,
|
1048
|
-
case_title: 'not args case(alias tfirst)',
|
1049
|
-
inputs: [[*1..5], [*6..10]],
|
1050
|
-
method_name: :tfirst,
|
1051
|
-
expected: [1, 6],
|
1052
|
-
has_args: false,
|
1053
|
-
},
|
1054
|
-
]
|
1055
|
-
|
1056
|
-
cases.each do |c|
|
1057
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1058
|
-
begin
|
1059
|
-
case_before c
|
1060
|
-
|
1061
|
-
# -- given --
|
1062
|
-
# nothing
|
1063
|
-
|
1064
|
-
# -- when --
|
1065
|
-
if c[:has_args]
|
1066
|
-
actual = c[:inputs].send c[:method_name], c[:args]
|
1067
|
-
else
|
1068
|
-
actual = c[:inputs].send c[:method_name]
|
1069
|
-
end
|
1070
|
-
|
1071
|
-
# -- then --
|
1072
|
-
expect(actual).to eq(c[:expected])
|
1073
|
-
ensure
|
1074
|
-
case_after c
|
1075
|
-
end
|
1076
|
-
end
|
1077
|
-
|
1078
|
-
def case_before(c)
|
1079
|
-
# implement each case before
|
1080
|
-
end
|
1081
|
-
|
1082
|
-
def case_after(c)
|
1083
|
-
# implement each case after
|
1084
|
-
end
|
1085
|
-
end
|
1086
|
-
end
|
1087
|
-
|
1088
|
-
context :together_include? do
|
1089
|
-
cases = [
|
1090
|
-
{
|
1091
|
-
case_no: 1,
|
1092
|
-
case_title: 'both include single ret case',
|
1093
|
-
inputs: [[*1..5], [*5..9]],
|
1094
|
-
value: 5,
|
1095
|
-
method_name: :together_include?,
|
1096
|
-
expected: true,
|
1097
|
-
is_multi: false,
|
1098
|
-
},
|
1099
|
-
{
|
1100
|
-
case_no: 2,
|
1101
|
-
case_title: 'one include single ret case',
|
1102
|
-
inputs: [[*1..5], [*5..9]],
|
1103
|
-
value: 9,
|
1104
|
-
method_name: :together_include?,
|
1105
|
-
expected: true,
|
1106
|
-
is_multi: false,
|
1107
|
-
},
|
1108
|
-
{
|
1109
|
-
case_no: 3,
|
1110
|
-
case_title: 'both not include single ret case',
|
1111
|
-
inputs: [[*1..5], [*5..9]],
|
1112
|
-
value: 10,
|
1113
|
-
method_name: :together_include?,
|
1114
|
-
expected: false,
|
1115
|
-
is_multi: false,
|
1116
|
-
},
|
1117
|
-
{
|
1118
|
-
case_no: 4,
|
1119
|
-
case_title: 'both include multi ret case',
|
1120
|
-
inputs: [[*1..5], [*5..9]],
|
1121
|
-
value: 5,
|
1122
|
-
method_name: :together_include?,
|
1123
|
-
expected: [true, true],
|
1124
|
-
is_multi: true,
|
1125
|
-
},
|
1126
|
-
{
|
1127
|
-
case_no: 5,
|
1128
|
-
case_title: 'one include multi ret case',
|
1129
|
-
inputs: [[*1..5], [*5..9]],
|
1130
|
-
value: 9,
|
1131
|
-
method_name: :together_include?,
|
1132
|
-
expected: [false, true],
|
1133
|
-
is_multi: true,
|
1134
|
-
},
|
1135
|
-
{
|
1136
|
-
case_no: 6,
|
1137
|
-
case_title: 'both not include multi ret case',
|
1138
|
-
inputs: [[*1..5], [*5..9]],
|
1139
|
-
value: 10,
|
1140
|
-
method_name: :together_include?,
|
1141
|
-
expected: [false, false],
|
1142
|
-
is_multi: true,
|
1143
|
-
},
|
1144
|
-
{
|
1145
|
-
case_no: 7,
|
1146
|
-
case_title: 'both include single ret case(alias tinclude?)',
|
1147
|
-
inputs: [[*1..5], [*5..9]],
|
1148
|
-
value: 5,
|
1149
|
-
method_name: :tinclude?,
|
1150
|
-
expected: true,
|
1151
|
-
is_multi: false,
|
1152
|
-
},
|
1153
|
-
]
|
1154
|
-
|
1155
|
-
cases.each do |c|
|
1156
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1157
|
-
begin
|
1158
|
-
case_before c
|
1159
|
-
|
1160
|
-
# -- given --
|
1161
|
-
# nothing
|
1162
|
-
|
1163
|
-
# -- when --
|
1164
|
-
actual = c[:inputs].send c[:method_name], c[:value], c[:is_multi]
|
1165
|
-
|
1166
|
-
# -- then --
|
1167
|
-
expect(actual).to eq(c[:expected])
|
1168
|
-
ensure
|
1169
|
-
case_after c
|
1170
|
-
end
|
1171
|
-
end
|
1172
|
-
|
1173
|
-
def case_before(c)
|
1174
|
-
# implement each case before
|
1175
|
-
end
|
1176
|
-
|
1177
|
-
def case_after(c)
|
1178
|
-
# implement each case after
|
1179
|
-
end
|
1180
|
-
end
|
1181
|
-
end
|
1182
|
-
|
1183
|
-
context :together_index do
|
1184
|
-
cases = [
|
1185
|
-
{
|
1186
|
-
case_no: 1,
|
1187
|
-
case_title: 'both index exist case',
|
1188
|
-
inputs: [[*1..5], [*5..9]],
|
1189
|
-
value: 5,
|
1190
|
-
method_name: :together_index,
|
1191
|
-
expected: [4, 0],
|
1192
|
-
},
|
1193
|
-
{
|
1194
|
-
case_no: 2,
|
1195
|
-
case_title: 'one index exist case',
|
1196
|
-
inputs: [[*1..5], [*5..9]],
|
1197
|
-
value: 4,
|
1198
|
-
method_name: :together_index,
|
1199
|
-
expected: [3, nil],
|
1200
|
-
},
|
1201
|
-
{
|
1202
|
-
case_no: 3,
|
1203
|
-
case_title: 'both not exist index case',
|
1204
|
-
inputs: [[*1..5], [*5..9]],
|
1205
|
-
value: 10,
|
1206
|
-
method_name: :together_index,
|
1207
|
-
expected: [nil, nil],
|
1208
|
-
},
|
1209
|
-
{
|
1210
|
-
case_no: 4,
|
1211
|
-
case_title: 'both index exist case(alias tindex)',
|
1212
|
-
inputs: [[*1..5], [*5..9]],
|
1213
|
-
value: 5,
|
1214
|
-
method_name: :tindex,
|
1215
|
-
expected: [4, 0],
|
1216
|
-
},
|
1217
|
-
]
|
1218
|
-
|
1219
|
-
cases.each do |c|
|
1220
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1221
|
-
begin
|
1222
|
-
case_before c
|
1223
|
-
|
1224
|
-
# -- given --
|
1225
|
-
# nothing
|
1226
|
-
|
1227
|
-
# -- when --
|
1228
|
-
actual = c[:inputs].send c[:method_name], c[:value]
|
1229
|
-
|
1230
|
-
# -- then --
|
1231
|
-
expect(actual).to eq(c[:expected])
|
1232
|
-
ensure
|
1233
|
-
case_after c
|
1234
|
-
end
|
1235
|
-
end
|
1236
|
-
|
1237
|
-
def case_before(c)
|
1238
|
-
# implement each case before
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
def case_after(c)
|
1242
|
-
# implement each case after
|
1243
|
-
end
|
1244
|
-
end
|
1245
|
-
end
|
1246
|
-
|
1247
|
-
context :together_insert do
|
1248
|
-
cases = [
|
1249
|
-
{
|
1250
|
-
case_no: 1,
|
1251
|
-
case_title: 'both insert exist case',
|
1252
|
-
inputs: [[*1..5], [*5..9]],
|
1253
|
-
exec_code: 'together_insert(1, 55, 66)',
|
1254
|
-
expected: [[1, 55, 66, 2, 3, 4, 5], [5, 55, 66, 6, 7, 8, 9]],
|
1255
|
-
},
|
1256
|
-
{
|
1257
|
-
case_no: 2,
|
1258
|
-
case_title: 'both insert exist and minus index case',
|
1259
|
-
inputs: [[*1..5], [*5..9]],
|
1260
|
-
exec_code: 'together_insert(-2, 55, 66)',
|
1261
|
-
expected: [[1, 2, 3, 4, 55, 66, 5], [5, 6, 7, 8, 55, 66, 9]],
|
1262
|
-
},
|
1263
|
-
{
|
1264
|
-
case_no: 3,
|
1265
|
-
case_title: 'both insert exist and over index case',
|
1266
|
-
inputs: [[*1..5], [*5..9]],
|
1267
|
-
exec_code: 'together_insert(6, 55, 66)',
|
1268
|
-
expected: [[1, 2, 3, 4, 5, nil, 55, 66], [5, 6, 7, 8, 9, nil, 55, 66]],
|
1269
|
-
},
|
1270
|
-
{
|
1271
|
-
case_no: 4,
|
1272
|
-
case_title: 'both insert exist case(alias tinsert)',
|
1273
|
-
inputs: [[*1..5], [*5..9]],
|
1274
|
-
exec_code: 'tinsert(1, 55, 66)',
|
1275
|
-
expected: [[1, 55, 66, 2, 3, 4, 5], [5, 55, 66, 6, 7, 8, 9]],
|
1276
|
-
},
|
1277
|
-
]
|
1278
|
-
|
1279
|
-
cases.each do |c|
|
1280
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1281
|
-
begin
|
1282
|
-
case_before c
|
1283
|
-
|
1284
|
-
# -- given --
|
1285
|
-
# nothing
|
1286
|
-
|
1287
|
-
# -- when --
|
1288
|
-
actual = eval "#{c[:inputs]}.#{c[:exec_code]}", binding
|
1289
|
-
|
1290
|
-
# -- then --
|
1291
|
-
expect(actual).to eq(c[:expected])
|
1292
|
-
ensure
|
1293
|
-
case_after c
|
1294
|
-
end
|
1295
|
-
end
|
1296
|
-
|
1297
|
-
def case_before(c)
|
1298
|
-
# implement each case before
|
1299
|
-
end
|
1300
|
-
|
1301
|
-
def case_after(c)
|
1302
|
-
# implement each case after
|
1303
|
-
end
|
1304
|
-
end
|
1305
|
-
end
|
1306
|
-
|
1307
|
-
context :together_shift do
|
1308
|
-
cases = [
|
1309
|
-
{
|
1310
|
-
case_no: 1,
|
1311
|
-
case_title: 'not empty case',
|
1312
|
-
inputs: [[1, 2], [5, 6]],
|
1313
|
-
method_name: 'together_shift',
|
1314
|
-
expected_ret: [1, 5],
|
1315
|
-
expected_self: [[2], [6]],
|
1316
|
-
},
|
1317
|
-
{
|
1318
|
-
case_no: 2,
|
1319
|
-
case_title: 'one empty case',
|
1320
|
-
inputs: [[1, 2], []],
|
1321
|
-
method_name: 'together_shift',
|
1322
|
-
expected_ret: [1, nil],
|
1323
|
-
expected_self: [[2], []],
|
1324
|
-
},
|
1325
|
-
{
|
1326
|
-
case_no: 3,
|
1327
|
-
case_title: 'both empty case',
|
1328
|
-
inputs: [[], []],
|
1329
|
-
method_name: 'together_shift',
|
1330
|
-
expected_ret: [nil, nil],
|
1331
|
-
expected_self: [[], []],
|
1332
|
-
},
|
1333
|
-
{
|
1334
|
-
case_no: 4,
|
1335
|
-
case_title: 'not empty, has args case',
|
1336
|
-
inputs: [[1, 2], [5, 6]],
|
1337
|
-
method_name: 'together_shift',
|
1338
|
-
args: 2,
|
1339
|
-
expected_ret: [[1, 2], [5, 6]],
|
1340
|
-
expected_self: [[], []],
|
1341
|
-
has_args: true,
|
1342
|
-
},
|
1343
|
-
{
|
1344
|
-
case_no: 5,
|
1345
|
-
case_title: 'one empty, has args case',
|
1346
|
-
inputs: [[1, 2], []],
|
1347
|
-
method_name: 'together_shift',
|
1348
|
-
args: 2,
|
1349
|
-
expected_ret: [[1, 2], []],
|
1350
|
-
expected_self: [[], []],
|
1351
|
-
has_args: true,
|
1352
|
-
},
|
1353
|
-
{
|
1354
|
-
case_no: 6,
|
1355
|
-
case_title: 'both empty, has args case',
|
1356
|
-
inputs: [[], []],
|
1357
|
-
method_name: 'together_shift',
|
1358
|
-
args: 2,
|
1359
|
-
expected_ret: [[], []],
|
1360
|
-
expected_self: [[], []],
|
1361
|
-
has_args: true,
|
1362
|
-
},
|
1363
|
-
{
|
1364
|
-
case_no: 7,
|
1365
|
-
case_title: 'not empty case(alias tshift)',
|
1366
|
-
inputs: [[1, 2], [5, 6]],
|
1367
|
-
method_name: 'tshift',
|
1368
|
-
expected_ret: [1, 5],
|
1369
|
-
expected_self: [[2], [6]],
|
1370
|
-
},
|
1371
|
-
]
|
1372
|
-
|
1373
|
-
cases.each do |c|
|
1374
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1375
|
-
begin
|
1376
|
-
case_before c
|
1377
|
-
|
1378
|
-
# -- given --
|
1379
|
-
# nothing
|
1380
|
-
|
1381
|
-
# -- when --
|
1382
|
-
actual = \
|
1383
|
-
if c[:has_args]
|
1384
|
-
c[:inputs].send c[:method_name], c[:args]
|
1385
|
-
else
|
1386
|
-
c[:inputs].send c[:method_name]
|
1387
|
-
end
|
1388
|
-
|
1389
|
-
# -- then --
|
1390
|
-
expect(actual).to eq(c[:expected_ret])
|
1391
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
1392
|
-
ensure
|
1393
|
-
case_after c
|
1394
|
-
end
|
1395
|
-
end
|
1396
|
-
|
1397
|
-
def case_before(c)
|
1398
|
-
# implement each case before
|
1399
|
-
end
|
1400
|
-
|
1401
|
-
def case_after(c)
|
1402
|
-
# implement each case after
|
1403
|
-
end
|
1404
|
-
end
|
1405
|
-
end
|
1406
|
-
|
1407
|
-
context :together_last do
|
1408
|
-
cases = [
|
1409
|
-
{
|
1410
|
-
case_no: 1,
|
1411
|
-
case_title: 'not args case',
|
1412
|
-
inputs: [[*1..5], [*6..10]],
|
1413
|
-
method_name: :together_last,
|
1414
|
-
expected: [5, 10],
|
1415
|
-
has_args: false,
|
1416
|
-
},
|
1417
|
-
{
|
1418
|
-
case_no: 2,
|
1419
|
-
case_title: 'has args 2 case',
|
1420
|
-
inputs: [[*1..5], [*6..10]],
|
1421
|
-
args: 2,
|
1422
|
-
method_name: :together_last,
|
1423
|
-
expected: [[4, 5], [9, 10]],
|
1424
|
-
has_args: true,
|
1425
|
-
},
|
1426
|
-
{
|
1427
|
-
case_no: 3,
|
1428
|
-
case_title: 'has args 0 case',
|
1429
|
-
inputs: [[*1..5], [*6..10]],
|
1430
|
-
args: 0,
|
1431
|
-
method_name: :together_last,
|
1432
|
-
expected: [[], []],
|
1433
|
-
has_args: true,
|
1434
|
-
},
|
1435
|
-
{
|
1436
|
-
case_no: 4,
|
1437
|
-
case_title: 'has args over size case',
|
1438
|
-
inputs: [[*1..5], [*6..10]],
|
1439
|
-
args: 6,
|
1440
|
-
method_name: :together_last,
|
1441
|
-
expected: [[*1..5], [*6..10]],
|
1442
|
-
has_args: true,
|
1443
|
-
},
|
1444
|
-
{
|
1445
|
-
case_no: 5,
|
1446
|
-
case_title: 'not args case(alias tlast)',
|
1447
|
-
inputs: [[*1..5], [*6..10]],
|
1448
|
-
method_name: :tlast,
|
1449
|
-
expected: [5, 10],
|
1450
|
-
has_args: false,
|
1451
|
-
},
|
1452
|
-
]
|
1453
|
-
|
1454
|
-
cases.each do |c|
|
1455
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1456
|
-
begin
|
1457
|
-
case_before c
|
1458
|
-
|
1459
|
-
# -- given --
|
1460
|
-
# nothing
|
1461
|
-
|
1462
|
-
# -- when --
|
1463
|
-
if c[:has_args]
|
1464
|
-
actual = c[:inputs].send c[:method_name], c[:args]
|
1465
|
-
else
|
1466
|
-
actual = c[:inputs].send c[:method_name]
|
1467
|
-
end
|
1468
|
-
|
1469
|
-
# -- then --
|
1470
|
-
expect(actual).to eq(c[:expected])
|
1471
|
-
ensure
|
1472
|
-
case_after c
|
1473
|
-
end
|
1474
|
-
end
|
1475
|
-
|
1476
|
-
def case_before(c)
|
1477
|
-
# implement each case before
|
1478
|
-
end
|
1479
|
-
|
1480
|
-
def case_after(c)
|
1481
|
-
# implement each case after
|
1482
|
-
end
|
1483
|
-
end
|
1484
|
-
end
|
1485
|
-
|
1486
|
-
context :together_pop do
|
1487
|
-
cases = [
|
1488
|
-
{
|
1489
|
-
case_no: 1,
|
1490
|
-
case_title: 'not empty case',
|
1491
|
-
inputs: [[1, 2], [5, 6]],
|
1492
|
-
method_name: 'together_pop',
|
1493
|
-
expected_ret: [2, 6],
|
1494
|
-
expected_self: [[1], [5]],
|
1495
|
-
},
|
1496
|
-
{
|
1497
|
-
case_no: 2,
|
1498
|
-
case_title: 'one empty case',
|
1499
|
-
inputs: [[1, 2], []],
|
1500
|
-
method_name: 'together_pop',
|
1501
|
-
expected_ret: [2, nil],
|
1502
|
-
expected_self: [[1], []],
|
1503
|
-
},
|
1504
|
-
{
|
1505
|
-
case_no: 3,
|
1506
|
-
case_title: 'both empty case',
|
1507
|
-
inputs: [[], []],
|
1508
|
-
method_name: 'together_pop',
|
1509
|
-
expected_ret: [nil, nil],
|
1510
|
-
expected_self: [[], []],
|
1511
|
-
},
|
1512
|
-
{
|
1513
|
-
case_no: 4,
|
1514
|
-
case_title: 'not empty, has args case',
|
1515
|
-
inputs: [[1, 2], [5, 6]],
|
1516
|
-
method_name: 'together_pop',
|
1517
|
-
args: 2,
|
1518
|
-
expected_ret: [[1, 2], [5, 6]],
|
1519
|
-
expected_self: [[], []],
|
1520
|
-
has_args: true,
|
1521
|
-
},
|
1522
|
-
{
|
1523
|
-
case_no: 5,
|
1524
|
-
case_title: 'one empty, has args case',
|
1525
|
-
inputs: [[1, 2], []],
|
1526
|
-
method_name: 'together_pop',
|
1527
|
-
args: 2,
|
1528
|
-
expected_ret: [[1, 2], []],
|
1529
|
-
expected_self: [[], []],
|
1530
|
-
has_args: true,
|
1531
|
-
},
|
1532
|
-
{
|
1533
|
-
case_no: 6,
|
1534
|
-
case_title: 'both empty, has args case',
|
1535
|
-
inputs: [[], []],
|
1536
|
-
method_name: 'together_pop',
|
1537
|
-
args: 2,
|
1538
|
-
expected_ret: [[], []],
|
1539
|
-
expected_self: [[], []],
|
1540
|
-
has_args: true,
|
1541
|
-
},
|
1542
|
-
{
|
1543
|
-
case_no: 7,
|
1544
|
-
case_title: 'not empty case(alias tpop)',
|
1545
|
-
inputs: [[1, 2], [5, 6]],
|
1546
|
-
method_name: 'tpop',
|
1547
|
-
expected_ret: [2, 6],
|
1548
|
-
expected_self: [[1], [5]],
|
1549
|
-
},
|
1550
|
-
]
|
1551
|
-
|
1552
|
-
cases.each do |c|
|
1553
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1554
|
-
begin
|
1555
|
-
case_before c
|
1556
|
-
|
1557
|
-
# -- given --
|
1558
|
-
# nothing
|
1559
|
-
|
1560
|
-
# -- when --
|
1561
|
-
actual = \
|
1562
|
-
if c[:has_args]
|
1563
|
-
c[:inputs].send c[:method_name], c[:args]
|
1564
|
-
else
|
1565
|
-
c[:inputs].send c[:method_name]
|
1566
|
-
end
|
1567
|
-
|
1568
|
-
# -- then --
|
1569
|
-
expect(actual).to eq(c[:expected_ret])
|
1570
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
1571
|
-
ensure
|
1572
|
-
case_after c
|
1573
|
-
end
|
1574
|
-
end
|
1575
|
-
|
1576
|
-
def case_before(c)
|
1577
|
-
# implement each case before
|
1578
|
-
end
|
1579
|
-
|
1580
|
-
def case_after(c)
|
1581
|
-
# implement each case after
|
1582
|
-
end
|
1583
|
-
end
|
1584
|
-
end
|
1585
|
-
|
1586
|
-
context :together_reverse do
|
1587
|
-
cases = [
|
1588
|
-
{
|
1589
|
-
case_no: 1,
|
1590
|
-
case_title: 'not empty case',
|
1591
|
-
inputs: [[1, 2], [5, 6]],
|
1592
|
-
method_name: 'together_reverse',
|
1593
|
-
expected_ret: [[2, 1], [6, 5]],
|
1594
|
-
expected_self: [[1, 2], [5, 6]],
|
1595
|
-
},
|
1596
|
-
{
|
1597
|
-
case_no: 2,
|
1598
|
-
case_title: 'one empty case',
|
1599
|
-
inputs: [[1, 2], []],
|
1600
|
-
method_name: 'together_reverse',
|
1601
|
-
expected_ret: [[2, 1], []],
|
1602
|
-
expected_self: [[1, 2], []],
|
1603
|
-
},
|
1604
|
-
{
|
1605
|
-
case_no: 3,
|
1606
|
-
case_title: 'not empty case(alias treverse)',
|
1607
|
-
inputs: [[1, 2], [5, 6]],
|
1608
|
-
method_name: 'treverse',
|
1609
|
-
expected_ret: [[2, 1], [6, 5]],
|
1610
|
-
expected_self: [[1, 2], [5, 6]],
|
1611
|
-
},
|
1612
|
-
]
|
1613
|
-
|
1614
|
-
cases.each do |c|
|
1615
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1616
|
-
begin
|
1617
|
-
case_before c
|
1618
|
-
|
1619
|
-
# -- given --
|
1620
|
-
# nothing
|
1621
|
-
|
1622
|
-
# -- when --
|
1623
|
-
actual = c[:inputs].send c[:method_name]
|
1624
|
-
|
1625
|
-
# -- then --
|
1626
|
-
expect(actual).to eq(c[:expected_ret])
|
1627
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
1628
|
-
ensure
|
1629
|
-
case_after c
|
1630
|
-
end
|
1631
|
-
end
|
1632
|
-
|
1633
|
-
def case_before(c)
|
1634
|
-
# implement each case before
|
1635
|
-
end
|
1636
|
-
|
1637
|
-
def case_after(c)
|
1638
|
-
# implement each case after
|
1639
|
-
end
|
1640
|
-
end
|
1641
|
-
end
|
1642
|
-
|
1643
|
-
context :together_reverse! do
|
1644
|
-
cases = [
|
1645
|
-
{
|
1646
|
-
case_no: 1,
|
1647
|
-
case_title: 'not empty case',
|
1648
|
-
inputs: [[1, 2], [5, 6]],
|
1649
|
-
method_name: 'together_reverse!',
|
1650
|
-
expected_ret: [[2, 1], [6, 5]],
|
1651
|
-
expected_self: [[2, 1], [6, 5]],
|
1652
|
-
},
|
1653
|
-
{
|
1654
|
-
case_no: 2,
|
1655
|
-
case_title: 'one empty case',
|
1656
|
-
inputs: [[1, 2], []],
|
1657
|
-
method_name: 'together_reverse!',
|
1658
|
-
expected_ret: [[2, 1], []],
|
1659
|
-
expected_self: [[2, 1], []],
|
1660
|
-
},
|
1661
|
-
{
|
1662
|
-
case_no: 3,
|
1663
|
-
case_title: 'not empty case(alias treverse!)',
|
1664
|
-
inputs: [[1, 2], [5, 6]],
|
1665
|
-
method_name: 'treverse!',
|
1666
|
-
expected_ret: [[2, 1], [6, 5]],
|
1667
|
-
expected_self: [[2, 1], [6, 5]],
|
1668
|
-
},
|
1669
|
-
]
|
1670
|
-
|
1671
|
-
cases.each do |c|
|
1672
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
1673
|
-
begin
|
1674
|
-
case_before c
|
1675
|
-
|
1676
|
-
# -- given --
|
1677
|
-
# nothing
|
1678
|
-
|
1679
|
-
# -- when --
|
1680
|
-
actual = c[:inputs].send c[:method_name]
|
1681
|
-
|
1682
|
-
# -- then --
|
1683
|
-
expect(actual).to eq(c[:expected_ret])
|
1684
|
-
expect(c[:inputs]).to eq(c[:expected_self])
|
1685
|
-
ensure
|
1686
|
-
case_after c
|
1687
|
-
end
|
1688
|
-
end
|
1689
|
-
|
1690
|
-
def case_before(c)
|
1691
|
-
# implement each case before
|
1692
|
-
end
|
1693
|
-
|
1694
|
-
def case_after(c)
|
1695
|
-
# implement each case after
|
1696
|
-
end
|
1697
|
-
end
|
1698
|
-
end
|
1699
|
-
end
|