hamster 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +16 -0
- data/README.rdoc +10 -10
- data/lib/hamster/core_ext/enumerable.rb +1 -1
- data/lib/hamster/core_ext/enumerable.rbc +481 -0
- data/lib/hamster/core_ext/io.rb +0 -1
- data/lib/hamster/core_ext/io.rbc +604 -0
- data/lib/hamster/hash.rb +6 -6
- data/lib/hamster/hash.rbc +3117 -0
- data/lib/hamster/list.rb +50 -14
- data/lib/hamster/list.rbc +7274 -0
- data/lib/hamster/set.rb +8 -7
- data/lib/hamster/set.rbc +3152 -0
- data/lib/hamster/stack.rbc +1358 -0
- data/lib/hamster/trie.rbc +3416 -0
- data/lib/hamster/version.rb +1 -1
- data/spec/hamster/core_ext/enumerable_spec.rb +1 -1
- data/spec/hamster/core_ext/enumerable_spec.rbc +747 -0
- data/spec/hamster/core_ext/io_spec.rbc +409 -0
- data/spec/hamster/hash/all_spec.rbc +1214 -0
- data/spec/hamster/hash/any_spec.rbc +1495 -0
- data/spec/hamster/hash/construction_spec.rbc +742 -0
- data/spec/hamster/hash/copying_spec.rbc +519 -0
- data/spec/hamster/hash/each_spec.rbc +908 -0
- data/spec/hamster/hash/empty_spec.rbc +517 -0
- data/spec/hamster/hash/eql_spec.rb +1 -1
- data/spec/hamster/hash/eql_spec.rbc +1702 -0
- data/spec/hamster/hash/filter_spec.rbc +1433 -0
- data/spec/hamster/hash/get_spec.rbc +791 -0
- data/spec/hamster/hash/has_key_spec.rbc +719 -0
- data/spec/hamster/hash/map_spec.rbc +1454 -0
- data/spec/hamster/hash/none_spec.rbc +1399 -0
- data/spec/hamster/hash/put_spec.rbc +1334 -0
- data/spec/hamster/hash/reduce_spec.rbc +1234 -0
- data/spec/hamster/hash/reject_spec.rbc +1445 -0
- data/spec/hamster/hash/remove_spec.rbc +1135 -0
- data/spec/hamster/hash/size_spec.rbc +596 -0
- data/spec/hamster/list/all_spec.rb +12 -4
- data/spec/hamster/list/all_spec.rbc +1760 -0
- data/spec/hamster/list/any_spec.rb +12 -4
- data/spec/hamster/list/any_spec.rbc +1888 -0
- data/spec/hamster/list/append_spec.rb +12 -5
- data/spec/hamster/list/append_spec.rbc +1555 -0
- data/spec/hamster/list/cadr_spec.rb +1 -1
- data/spec/hamster/list/cadr_spec.rbc +855 -0
- data/spec/hamster/list/cons_spec.rbc +848 -0
- data/spec/hamster/list/construction_spec.rbc +1732 -0
- data/spec/hamster/list/copying_spec.rbc +555 -0
- data/spec/hamster/list/drop_spec.rb +12 -4
- data/spec/hamster/list/drop_spec.rbc +1081 -0
- data/spec/hamster/list/drop_while_spec.rb +12 -4
- data/spec/hamster/list/drop_while_spec.rbc +1286 -0
- data/spec/hamster/list/each_spec.rb +13 -5
- data/spec/hamster/list/each_spec.rbc +1365 -0
- data/spec/hamster/list/empty_spec.rb +1 -1
- data/spec/hamster/list/empty_spec.rbc +571 -0
- data/spec/hamster/list/eql_spec.rb +15 -5
- data/spec/hamster/list/eql_spec.rbc +1819 -0
- data/spec/hamster/list/filter_spec.rb +13 -5
- data/spec/hamster/list/filter_spec.rbc +1595 -0
- data/spec/hamster/list/find_spec.rb +12 -4
- data/spec/hamster/list/find_spec.rbc +1456 -0
- data/spec/hamster/list/head_spec.rb +1 -1
- data/spec/hamster/list/head_spec.rbc +575 -0
- data/spec/hamster/list/include_spec.rb +12 -4
- data/spec/hamster/list/include_spec.rbc +1173 -0
- data/spec/hamster/list/inspect_spec.rb +13 -5
- data/spec/hamster/list/inspect_spec.rbc +995 -0
- data/spec/hamster/list/map_spec.rb +12 -4
- data/spec/hamster/list/map_spec.rbc +1545 -0
- data/spec/hamster/list/maximum_spec.rb +83 -0
- data/spec/hamster/list/minimum_spec.rb +83 -0
- data/spec/hamster/list/none_spec.rb +11 -3
- data/spec/hamster/list/none_spec.rbc +1788 -0
- data/spec/hamster/list/one_spec.rb +83 -0
- data/spec/hamster/list/partition_spec.rb +37 -9
- data/spec/hamster/list/partition_spec.rbc +2715 -0
- data/spec/hamster/list/reduce_spec.rb +12 -4
- data/spec/hamster/list/reduce_spec.rbc +2081 -0
- data/spec/hamster/list/reject_spec.rb +12 -4
- data/spec/hamster/list/reject_spec.rbc +1590 -0
- data/spec/hamster/list/reverse_spec.rb +12 -4
- data/spec/hamster/list/reverse_spec.rbc +1061 -0
- data/spec/hamster/list/size_spec.rb +13 -5
- data/spec/hamster/list/size_spec.rbc +1063 -0
- data/spec/hamster/list/tail_spec.rb +1 -1
- data/spec/hamster/list/tail_spec.rbc +595 -0
- data/spec/hamster/list/take_spec.rb +12 -4
- data/spec/hamster/list/take_spec.rbc +1075 -0
- data/spec/hamster/list/take_while_spec.rb +12 -4
- data/spec/hamster/list/take_while_spec.rbc +1446 -0
- data/spec/hamster/list/to_a_spec.rb +31 -19
- data/spec/hamster/list/to_a_spec.rbc +961 -0
- data/spec/hamster/list/to_ary_spec.rb +11 -3
- data/spec/hamster/list/to_ary_spec.rbc +1080 -0
- data/spec/hamster/list/to_list_spec.rb +31 -0
- data/spec/hamster/set/add_spec.rbc +1039 -0
- data/spec/hamster/set/all_spec.rbc +1316 -0
- data/spec/hamster/set/any_spec.rbc +1444 -0
- data/spec/hamster/set/construction_spec.rbc +422 -0
- data/spec/hamster/set/copying_spec.rbc +469 -0
- data/spec/hamster/set/each_spec.rbc +820 -0
- data/spec/hamster/set/empty_spec.rbc +452 -0
- data/spec/hamster/set/eql_spec.rb +1 -1
- data/spec/hamster/set/eql_spec.rbc +1309 -0
- data/spec/hamster/set/filter_spec.rbc +1272 -0
- data/spec/hamster/set/include_spec.rbc +657 -0
- data/spec/hamster/set/map_spec.rbc +1285 -0
- data/spec/hamster/set/none_spec.rbc +1344 -0
- data/spec/hamster/set/reduce_spec.rbc +1177 -0
- data/spec/hamster/set/reject_spec.rbc +1273 -0
- data/spec/hamster/set/remove_spec.rbc +947 -0
- data/spec/hamster/set/size_spec.rbc +531 -0
- data/spec/hamster/set/to_a_spec.rb +16 -12
- data/spec/hamster/set/to_a_spec.rbc +559 -0
- data/spec/hamster/stack/construction_spec.rbc +862 -0
- data/spec/hamster/stack/copying_spec.rbc +555 -0
- data/spec/hamster/stack/empty_spec.rb +1 -1
- data/spec/hamster/stack/empty_spec.rbc +571 -0
- data/spec/hamster/stack/eql_spec.rb +1 -1
- data/spec/hamster/stack/eql_spec.rbc +1281 -0
- data/spec/hamster/stack/inspect_spec.rb +1 -1
- data/spec/hamster/stack/inspect_spec.rbc +586 -0
- data/spec/hamster/stack/pop_spec.rbc +1099 -0
- data/spec/hamster/stack/push_spec.rbc +848 -0
- data/spec/hamster/stack/size_spec.rb +1 -1
- data/spec/hamster/stack/size_spec.rbc +650 -0
- data/spec/hamster/stack/top_spec.rbc +676 -0
- data/spec/hamster/trie/remove_spec.rbc +40 -0
- data/spec/spec_helper.rbc +163 -0
- data/tasks/spec.rbc +201 -0
- metadata +90 -2
@@ -4,22 +4,26 @@ require 'hamster/set'
|
|
4
4
|
|
5
5
|
describe Hamster::Set do
|
6
6
|
|
7
|
-
|
7
|
+
[:to_a, :entries].each do |method|
|
8
8
|
|
9
|
-
|
10
|
-
[],
|
11
|
-
["A"],
|
12
|
-
["A", "B", "C"],
|
13
|
-
].each do |values|
|
9
|
+
describe "##{method}" do
|
14
10
|
|
15
|
-
|
11
|
+
[
|
12
|
+
[],
|
13
|
+
["A"],
|
14
|
+
["A", "B", "C"],
|
15
|
+
].each do |values|
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
describe "on #{values.inspect}" do
|
18
|
+
|
19
|
+
before do
|
20
|
+
@set = Hamster.set(*values)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns #{values.inspect}" do
|
24
|
+
@set.send(method).sort.should == values.sort
|
25
|
+
end
|
20
26
|
|
21
|
-
it "returns #{values.inspect}" do
|
22
|
-
@set.to_a.sort.should == values.sort
|
23
27
|
end
|
24
28
|
|
25
29
|
end
|
@@ -0,0 +1,559 @@
|
|
1
|
+
!RBIX
|
2
|
+
0
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
50
|
13
|
+
5
|
14
|
+
42
|
15
|
+
0
|
16
|
+
1
|
17
|
+
42
|
18
|
+
0
|
19
|
+
2
|
20
|
+
61
|
21
|
+
45
|
22
|
+
3
|
23
|
+
46
|
24
|
+
4
|
25
|
+
1
|
26
|
+
7
|
27
|
+
5
|
28
|
+
60
|
29
|
+
77
|
30
|
+
6
|
31
|
+
46
|
32
|
+
7
|
33
|
+
1
|
34
|
+
44
|
35
|
+
46
|
36
|
+
8
|
37
|
+
1
|
38
|
+
14
|
39
|
+
5
|
40
|
+
7
|
41
|
+
9
|
42
|
+
60
|
43
|
+
44
|
44
|
+
46
|
45
|
+
8
|
46
|
+
1
|
47
|
+
14
|
48
|
+
5
|
49
|
+
42
|
50
|
+
10
|
51
|
+
11
|
52
|
+
40
|
53
|
+
12
|
54
|
+
53
|
55
|
+
13
|
56
|
+
44
|
57
|
+
47
|
58
|
+
14
|
59
|
+
1
|
60
|
+
14
|
61
|
+
2
|
62
|
+
11
|
63
|
+
I
|
64
|
+
4
|
65
|
+
I
|
66
|
+
0
|
67
|
+
I
|
68
|
+
0
|
69
|
+
I
|
70
|
+
0
|
71
|
+
n
|
72
|
+
p
|
73
|
+
15
|
74
|
+
x
|
75
|
+
4
|
76
|
+
File
|
77
|
+
n
|
78
|
+
n
|
79
|
+
x
|
80
|
+
11
|
81
|
+
active_path
|
82
|
+
x
|
83
|
+
7
|
84
|
+
dirname
|
85
|
+
s
|
86
|
+
18
|
87
|
+
/../../spec_helper
|
88
|
+
x
|
89
|
+
1
|
90
|
+
+
|
91
|
+
x
|
92
|
+
11
|
93
|
+
expand_path
|
94
|
+
x
|
95
|
+
7
|
96
|
+
require
|
97
|
+
s
|
98
|
+
11
|
99
|
+
hamster/set
|
100
|
+
x
|
101
|
+
7
|
102
|
+
Hamster
|
103
|
+
n
|
104
|
+
x
|
105
|
+
3
|
106
|
+
Set
|
107
|
+
M
|
108
|
+
1
|
109
|
+
n
|
110
|
+
n
|
111
|
+
x
|
112
|
+
9
|
113
|
+
__block__
|
114
|
+
i
|
115
|
+
11
|
116
|
+
5
|
117
|
+
7
|
118
|
+
0
|
119
|
+
60
|
120
|
+
53
|
121
|
+
1
|
122
|
+
44
|
123
|
+
47
|
124
|
+
2
|
125
|
+
1
|
126
|
+
11
|
127
|
+
I
|
128
|
+
4
|
129
|
+
I
|
130
|
+
0
|
131
|
+
I
|
132
|
+
-1
|
133
|
+
I
|
134
|
+
-1
|
135
|
+
n
|
136
|
+
p
|
137
|
+
3
|
138
|
+
s
|
139
|
+
5
|
140
|
+
#to_a
|
141
|
+
M
|
142
|
+
1
|
143
|
+
n
|
144
|
+
n
|
145
|
+
x
|
146
|
+
9
|
147
|
+
__block__
|
148
|
+
i
|
149
|
+
26
|
150
|
+
32
|
151
|
+
0
|
152
|
+
7
|
153
|
+
0
|
154
|
+
60
|
155
|
+
32
|
156
|
+
1
|
157
|
+
7
|
158
|
+
0
|
159
|
+
60
|
160
|
+
7
|
161
|
+
1
|
162
|
+
60
|
163
|
+
7
|
164
|
+
2
|
165
|
+
60
|
166
|
+
32
|
167
|
+
3
|
168
|
+
32
|
169
|
+
3
|
170
|
+
53
|
171
|
+
3
|
172
|
+
47
|
173
|
+
4
|
174
|
+
0
|
175
|
+
11
|
176
|
+
I
|
177
|
+
6
|
178
|
+
I
|
179
|
+
0
|
180
|
+
I
|
181
|
+
-1
|
182
|
+
I
|
183
|
+
-1
|
184
|
+
n
|
185
|
+
p
|
186
|
+
5
|
187
|
+
s
|
188
|
+
1
|
189
|
+
A
|
190
|
+
s
|
191
|
+
1
|
192
|
+
B
|
193
|
+
s
|
194
|
+
1
|
195
|
+
C
|
196
|
+
M
|
197
|
+
1
|
198
|
+
n
|
199
|
+
n
|
200
|
+
x
|
201
|
+
9
|
202
|
+
__block__
|
203
|
+
i
|
204
|
+
23
|
205
|
+
54
|
206
|
+
17
|
207
|
+
0
|
208
|
+
14
|
209
|
+
5
|
210
|
+
18
|
211
|
+
0
|
212
|
+
45
|
213
|
+
0
|
214
|
+
44
|
215
|
+
45
|
216
|
+
1
|
217
|
+
7
|
218
|
+
2
|
219
|
+
60
|
220
|
+
59
|
221
|
+
53
|
222
|
+
3
|
223
|
+
44
|
224
|
+
47
|
225
|
+
4
|
226
|
+
1
|
227
|
+
11
|
228
|
+
I
|
229
|
+
5
|
230
|
+
I
|
231
|
+
1
|
232
|
+
I
|
233
|
+
1
|
234
|
+
I
|
235
|
+
1
|
236
|
+
n
|
237
|
+
p
|
238
|
+
5
|
239
|
+
x
|
240
|
+
7
|
241
|
+
inspect
|
242
|
+
x
|
243
|
+
4
|
244
|
+
to_s
|
245
|
+
s
|
246
|
+
3
|
247
|
+
on
|
248
|
+
M
|
249
|
+
1
|
250
|
+
n
|
251
|
+
n
|
252
|
+
x
|
253
|
+
9
|
254
|
+
__block__
|
255
|
+
i
|
256
|
+
28
|
257
|
+
5
|
258
|
+
53
|
259
|
+
0
|
260
|
+
44
|
261
|
+
47
|
262
|
+
1
|
263
|
+
0
|
264
|
+
14
|
265
|
+
5
|
266
|
+
19
|
267
|
+
1
|
268
|
+
0
|
269
|
+
45
|
270
|
+
2
|
271
|
+
44
|
272
|
+
45
|
273
|
+
3
|
274
|
+
7
|
275
|
+
4
|
276
|
+
60
|
277
|
+
59
|
278
|
+
53
|
279
|
+
5
|
280
|
+
44
|
281
|
+
47
|
282
|
+
6
|
283
|
+
1
|
284
|
+
11
|
285
|
+
I
|
286
|
+
4
|
287
|
+
I
|
288
|
+
0
|
289
|
+
I
|
290
|
+
-1
|
291
|
+
I
|
292
|
+
-1
|
293
|
+
n
|
294
|
+
p
|
295
|
+
7
|
296
|
+
M
|
297
|
+
1
|
298
|
+
n
|
299
|
+
n
|
300
|
+
x
|
301
|
+
9
|
302
|
+
__block__
|
303
|
+
i
|
304
|
+
14
|
305
|
+
42
|
306
|
+
0
|
307
|
+
1
|
308
|
+
19
|
309
|
+
2
|
310
|
+
0
|
311
|
+
33
|
312
|
+
1
|
313
|
+
48
|
314
|
+
2
|
315
|
+
0
|
316
|
+
35
|
317
|
+
3
|
318
|
+
11
|
319
|
+
I
|
320
|
+
4
|
321
|
+
I
|
322
|
+
0
|
323
|
+
I
|
324
|
+
-1
|
325
|
+
I
|
326
|
+
-1
|
327
|
+
n
|
328
|
+
p
|
329
|
+
4
|
330
|
+
x
|
331
|
+
7
|
332
|
+
Hamster
|
333
|
+
n
|
334
|
+
x
|
335
|
+
3
|
336
|
+
set
|
337
|
+
x
|
338
|
+
4
|
339
|
+
@set
|
340
|
+
p
|
341
|
+
5
|
342
|
+
I
|
343
|
+
0
|
344
|
+
I
|
345
|
+
11
|
346
|
+
I
|
347
|
+
0
|
348
|
+
I
|
349
|
+
12
|
350
|
+
I
|
351
|
+
e
|
352
|
+
x
|
353
|
+
31
|
354
|
+
./spec/hamster/set/to_a_spec.rb
|
355
|
+
p
|
356
|
+
0
|
357
|
+
x
|
358
|
+
6
|
359
|
+
before
|
360
|
+
x
|
361
|
+
7
|
362
|
+
inspect
|
363
|
+
x
|
364
|
+
4
|
365
|
+
to_s
|
366
|
+
s
|
367
|
+
8
|
368
|
+
returns
|
369
|
+
M
|
370
|
+
1
|
371
|
+
n
|
372
|
+
n
|
373
|
+
x
|
374
|
+
9
|
375
|
+
__block__
|
376
|
+
i
|
377
|
+
16
|
378
|
+
36
|
379
|
+
0
|
380
|
+
45
|
381
|
+
1
|
382
|
+
45
|
383
|
+
2
|
384
|
+
45
|
385
|
+
3
|
386
|
+
19
|
387
|
+
2
|
388
|
+
0
|
389
|
+
45
|
390
|
+
2
|
391
|
+
79
|
392
|
+
4
|
393
|
+
11
|
394
|
+
I
|
395
|
+
3
|
396
|
+
I
|
397
|
+
0
|
398
|
+
I
|
399
|
+
-1
|
400
|
+
I
|
401
|
+
-1
|
402
|
+
n
|
403
|
+
p
|
404
|
+
5
|
405
|
+
x
|
406
|
+
4
|
407
|
+
@set
|
408
|
+
x
|
409
|
+
4
|
410
|
+
to_a
|
411
|
+
x
|
412
|
+
4
|
413
|
+
sort
|
414
|
+
x
|
415
|
+
6
|
416
|
+
should
|
417
|
+
x
|
418
|
+
2
|
419
|
+
==
|
420
|
+
p
|
421
|
+
5
|
422
|
+
I
|
423
|
+
0
|
424
|
+
I
|
425
|
+
15
|
426
|
+
I
|
427
|
+
0
|
428
|
+
I
|
429
|
+
16
|
430
|
+
I
|
431
|
+
10
|
432
|
+
x
|
433
|
+
31
|
434
|
+
./spec/hamster/set/to_a_spec.rb
|
435
|
+
p
|
436
|
+
0
|
437
|
+
x
|
438
|
+
2
|
439
|
+
it
|
440
|
+
p
|
441
|
+
7
|
442
|
+
I
|
443
|
+
0
|
444
|
+
I
|
445
|
+
f
|
446
|
+
I
|
447
|
+
0
|
448
|
+
I
|
449
|
+
11
|
450
|
+
I
|
451
|
+
8
|
452
|
+
I
|
453
|
+
15
|
454
|
+
I
|
455
|
+
1c
|
456
|
+
x
|
457
|
+
31
|
458
|
+
./spec/hamster/set/to_a_spec.rb
|
459
|
+
p
|
460
|
+
0
|
461
|
+
x
|
462
|
+
8
|
463
|
+
describe
|
464
|
+
p
|
465
|
+
7
|
466
|
+
I
|
467
|
+
0
|
468
|
+
I
|
469
|
+
a
|
470
|
+
I
|
471
|
+
1
|
472
|
+
I
|
473
|
+
d
|
474
|
+
I
|
475
|
+
4
|
476
|
+
I
|
477
|
+
f
|
478
|
+
I
|
479
|
+
17
|
480
|
+
x
|
481
|
+
31
|
482
|
+
./spec/hamster/set/to_a_spec.rb
|
483
|
+
p
|
484
|
+
1
|
485
|
+
x
|
486
|
+
6
|
487
|
+
values
|
488
|
+
x
|
489
|
+
4
|
490
|
+
each
|
491
|
+
p
|
492
|
+
9
|
493
|
+
I
|
494
|
+
0
|
495
|
+
I
|
496
|
+
7
|
497
|
+
I
|
498
|
+
0
|
499
|
+
I
|
500
|
+
a
|
501
|
+
I
|
502
|
+
2
|
503
|
+
I
|
504
|
+
b
|
505
|
+
I
|
506
|
+
7
|
507
|
+
I
|
508
|
+
c
|
509
|
+
I
|
510
|
+
1a
|
511
|
+
x
|
512
|
+
31
|
513
|
+
./spec/hamster/set/to_a_spec.rb
|
514
|
+
p
|
515
|
+
0
|
516
|
+
x
|
517
|
+
8
|
518
|
+
describe
|
519
|
+
p
|
520
|
+
5
|
521
|
+
I
|
522
|
+
0
|
523
|
+
I
|
524
|
+
5
|
525
|
+
I
|
526
|
+
0
|
527
|
+
I
|
528
|
+
7
|
529
|
+
I
|
530
|
+
b
|
531
|
+
x
|
532
|
+
31
|
533
|
+
./spec/hamster/set/to_a_spec.rb
|
534
|
+
p
|
535
|
+
0
|
536
|
+
x
|
537
|
+
8
|
538
|
+
describe
|
539
|
+
p
|
540
|
+
7
|
541
|
+
I
|
542
|
+
0
|
543
|
+
I
|
544
|
+
1
|
545
|
+
I
|
546
|
+
1a
|
547
|
+
I
|
548
|
+
3
|
549
|
+
I
|
550
|
+
23
|
551
|
+
I
|
552
|
+
5
|
553
|
+
I
|
554
|
+
32
|
555
|
+
x
|
556
|
+
31
|
557
|
+
./spec/hamster/set/to_a_spec.rb
|
558
|
+
p
|
559
|
+
0
|