hamster 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +16 -0
- data/lib/hamster/core_ext/enumerable.rb +9 -1
- data/lib/hamster/hash.rb +7 -0
- data/lib/hamster/list.rb +110 -109
- data/lib/hamster/set.rb +4 -3
- data/lib/hamster/sorter.rb +19 -0
- data/lib/hamster/tuple.rb +7 -0
- data/lib/hamster/version.rb +1 -1
- data/spec/hamster/core_ext/array_spec.rb +20 -0
- data/spec/hamster/core_ext/enumerable_spec.rb +1 -1
- data/spec/hamster/core_ext/io_spec.rb +1 -1
- data/spec/hamster/hash/all_spec.rb +1 -1
- data/spec/hamster/hash/any_spec.rb +1 -1
- data/spec/hamster/hash/construction_spec.rb +1 -1
- data/spec/hamster/hash/copying_spec.rb +1 -1
- data/spec/hamster/hash/delete_spec.rb +1 -1
- data/spec/hamster/hash/each_spec.rb +1 -1
- data/spec/hamster/hash/empty_spec.rb +1 -1
- data/spec/hamster/hash/eql_spec.rb +1 -1
- data/spec/hamster/hash/filter_spec.rb +1 -1
- data/spec/hamster/hash/find_spec.rb +58 -0
- data/spec/hamster/hash/get_spec.rb +1 -1
- data/spec/hamster/hash/has_key_spec.rb +7 -3
- data/spec/hamster/hash/inspect_spec.rb +1 -1
- data/spec/hamster/hash/map_spec.rb +1 -1
- data/spec/hamster/hash/none_spec.rb +1 -1
- data/spec/hamster/hash/put_spec.rb +1 -1
- data/spec/hamster/hash/reduce_spec.rb +1 -1
- data/spec/hamster/hash/remove_spec.rb +1 -1
- data/spec/hamster/hash/size_spec.rb +1 -1
- data/spec/hamster/hash/uniq_spec.rb +1 -1
- data/spec/hamster/list/all_spec.rb +1 -1
- data/spec/hamster/list/any_spec.rb +1 -1
- data/spec/hamster/list/append_spec.rb +1 -1
- data/spec/hamster/list/at_spec.rb +1 -1
- data/spec/hamster/list/break_spec.rb +1 -1
- data/spec/hamster/list/cadr_spec.rb +1 -1
- data/spec/hamster/list/chunk_spec.rb +1 -1
- data/spec/hamster/list/clear_spec.rb +1 -1
- data/spec/hamster/list/combinations_spec.rb +1 -1
- data/spec/hamster/list/compact_spec.rb +1 -1
- data/spec/hamster/list/cons_spec.rb +1 -1
- data/spec/hamster/list/construction_spec.rb +1 -1
- data/spec/hamster/list/copying_spec.rb +1 -1
- data/spec/hamster/list/count_spec.rb +1 -1
- data/spec/hamster/list/cycle_spec.rb +1 -1
- data/spec/hamster/list/drop_spec.rb +1 -1
- data/spec/hamster/list/drop_while_spec.rb +1 -1
- data/spec/hamster/list/each_slice_spec.rb +1 -1
- data/spec/hamster/list/each_spec.rb +1 -1
- data/spec/hamster/list/elem_index_spec.rb +58 -0
- data/spec/hamster/list/elem_indices_spec.rb +45 -0
- data/spec/hamster/list/empty_spec.rb +1 -1
- data/spec/hamster/list/eql_spec.rb +1 -1
- data/spec/hamster/list/filter_spec.rb +1 -1
- data/spec/hamster/list/find_index_spec.rb +58 -0
- data/spec/hamster/list/find_indices_spec.rb +45 -0
- data/spec/hamster/list/find_spec.rb +1 -1
- data/spec/hamster/list/flatten_spec.rb +1 -1
- data/spec/hamster/list/grep_spec.rb +1 -1
- data/spec/hamster/list/group_by_spec.rb +1 -1
- data/spec/hamster/list/head_spec.rb +1 -1
- data/spec/hamster/list/include_spec.rb +1 -1
- data/spec/hamster/list/init_spec.rb +1 -1
- data/spec/hamster/list/inits_spec.rb +1 -1
- data/spec/hamster/list/inspect_spec.rb +1 -1
- data/spec/hamster/list/intersperse_spec.rb +1 -1
- data/spec/hamster/list/join_spec.rb +1 -1
- data/spec/hamster/list/last_spec.rb +1 -1
- data/spec/hamster/list/map_spec.rb +1 -1
- data/spec/hamster/list/maximum_spec.rb +1 -1
- data/spec/hamster/list/minimum_spec.rb +1 -1
- data/spec/hamster/list/none_spec.rb +1 -1
- data/spec/hamster/list/one_spec.rb +2 -2
- data/spec/hamster/list/partition_spec.rb +1 -1
- data/spec/hamster/list/product_spec.rb +1 -1
- data/spec/hamster/list/reduce_spec.rb +1 -1
- data/spec/hamster/list/remove_spec.rb +1 -1
- data/spec/hamster/list/reverse_spec.rb +1 -1
- data/spec/hamster/list/size_spec.rb +1 -1
- data/spec/hamster/list/slice_spec.rb +1 -1
- data/spec/hamster/list/sorting_spec.rb +1 -1
- data/spec/hamster/list/span_spec.rb +1 -1
- data/spec/hamster/list/split_at_spec.rb +1 -1
- data/spec/hamster/list/sum_spec.rb +1 -1
- data/spec/hamster/list/tail_spec.rb +1 -1
- data/spec/hamster/list/tails_spec.rb +1 -1
- data/spec/hamster/list/take_spec.rb +1 -1
- data/spec/hamster/list/take_while_spec.rb +1 -1
- data/spec/hamster/list/to_a_spec.rb +1 -1
- data/spec/hamster/list/to_ary_spec.rb +1 -1
- data/spec/hamster/list/to_list_spec.rb +1 -1
- data/spec/hamster/list/union_spec.rb +1 -1
- data/spec/hamster/list/uniq_spec.rb +1 -1
- data/spec/hamster/list/zip_spec.rb +1 -1
- data/spec/hamster/set/add_spec.rb +1 -1
- data/spec/hamster/set/all_spec.rb +1 -1
- data/spec/hamster/set/any_spec.rb +1 -1
- data/spec/hamster/set/clear_spec.rb +1 -1
- data/spec/hamster/set/compact_spec.rb +1 -1
- data/spec/hamster/set/construction_spec.rb +1 -1
- data/spec/hamster/set/copying_spec.rb +1 -1
- data/spec/hamster/set/count_spec.rb +1 -1
- data/spec/hamster/set/delete_spec.rb +1 -1
- data/spec/hamster/set/each_spec.rb +1 -1
- data/spec/hamster/set/empty_spec.rb +1 -1
- data/spec/hamster/set/eql_spec.rb +1 -1
- data/spec/hamster/set/filter_spec.rb +1 -1
- data/spec/hamster/set/find_spec.rb +1 -1
- data/spec/hamster/set/grep_spec.rb +1 -1
- data/spec/hamster/set/group_by_spec.rb +1 -1
- data/spec/hamster/set/head_spec.rb +1 -1
- data/spec/hamster/set/include_spec.rb +1 -1
- data/spec/hamster/set/inspect_spec.rb +1 -1
- data/spec/hamster/set/join_spec.rb +1 -1
- data/spec/hamster/set/map_spec.rb +1 -1
- data/spec/hamster/set/maximum_spec.rb +1 -1
- data/spec/hamster/set/minimum_spec.rb +1 -1
- data/spec/hamster/set/none_spec.rb +1 -1
- data/spec/hamster/set/one_spec.rb +2 -2
- data/spec/hamster/set/partition_spec.rb +1 -1
- data/spec/hamster/set/product_spec.rb +1 -1
- data/spec/hamster/set/reduce_spec.rb +1 -1
- data/spec/hamster/set/remove_spec.rb +1 -1
- data/spec/hamster/set/size_spec.rb +1 -1
- data/spec/hamster/set/sorting_spec.rb +1 -1
- data/spec/hamster/set/sum_spec.rb +1 -1
- data/spec/hamster/set/to_a_spec.rb +1 -1
- data/spec/hamster/set/to_list_spec.rb +1 -1
- data/spec/hamster/set/to_set_spec.rb +1 -1
- data/spec/hamster/set/uniq_spec.rb +1 -1
- data/spec/hamster/stack/clear_spec.rb +1 -1
- data/spec/hamster/stack/construction_spec.rb +1 -1
- data/spec/hamster/stack/copying_spec.rb +1 -1
- data/spec/hamster/stack/empty_spec.rb +1 -1
- data/spec/hamster/stack/eql_spec.rb +1 -1
- data/spec/hamster/stack/inspect_spec.rb +1 -1
- data/spec/hamster/stack/pop_spec.rb +1 -1
- data/spec/hamster/stack/push_spec.rb +1 -1
- data/spec/hamster/stack/size_spec.rb +1 -1
- data/spec/hamster/stack/to_a_spec.rb +1 -1
- data/spec/hamster/stack/to_list_spec.rb +1 -1
- data/spec/hamster/stack/top_spec.rb +1 -1
- data/spec/hamster/trie/remove_spec.rb +1 -1
- data/spec/hamster/tuple/copying_spec.rb +1 -1
- data/spec/hamster/tuple/eql_spec.rb +61 -0
- data/spec/hamster/tuple/first_spec.rb +1 -1
- data/spec/hamster/tuple/inspect_spec.rb +1 -1
- data/spec/hamster/tuple/last_spec.rb +1 -1
- data/spec/hamster/tuple/to_a_spec.rb +1 -1
- data/spec/hamster/tuple/to_ary_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -6
- metadata +20 -148
- data/lib/hamster.rbc +0 -133
- data/lib/hamster/core_ext.rbc +0 -69
- data/lib/hamster/core_ext/enumerable.rbc +0 -481
- data/lib/hamster/core_ext/io.rbc +0 -652
- data/lib/hamster/hash.rbc +0 -3537
- data/lib/hamster/list.rbc +0 -14428
- data/lib/hamster/set.rbc +0 -5541
- data/lib/hamster/stack.rbc +0 -1623
- data/lib/hamster/trie.rbc +0 -3449
- data/lib/hamster/tuple.rbc +0 -800
- data/lib/hamster/version.rbc +0 -143
- data/spec/hamster/core_ext/enumerable_spec.rbc +0 -751
- data/spec/hamster/core_ext/io_spec.rbc +0 -413
- data/spec/hamster/hash/all_spec.rbc +0 -1312
- data/spec/hamster/hash/any_spec.rbc +0 -1501
- data/spec/hamster/hash/construction_spec.rbc +0 -750
- data/spec/hamster/hash/copying_spec.rbc +0 -524
- data/spec/hamster/hash/delete_spec.rbc +0 -1146
- data/spec/hamster/hash/each_spec.rbc +0 -997
- data/spec/hamster/hash/empty_spec.rbc +0 -597
- data/spec/hamster/hash/eql_spec.rbc +0 -1704
- data/spec/hamster/hash/filter_spec.rbc +0 -1450
- data/spec/hamster/hash/get_spec.rbc +0 -793
- data/spec/hamster/hash/has_key_spec.rbc +0 -720
- data/spec/hamster/hash/inspect_spec.rbc +0 -658
- data/spec/hamster/hash/map_spec.rbc +0 -1471
- data/spec/hamster/hash/none_spec.rbc +0 -1404
- data/spec/hamster/hash/put_spec.rbc +0 -1346
- data/spec/hamster/hash/reduce_spec.rbc +0 -1255
- data/spec/hamster/hash/remove_spec.rbc +0 -1467
- data/spec/hamster/hash/size_spec.rbc +0 -598
- data/spec/hamster/hash/uniq_spec.rbc +0 -529
- data/spec/hamster/list/all_spec.rbc +0 -2158
- data/spec/hamster/list/any_spec.rbc +0 -1751
- data/spec/hamster/list/append_spec.rbc +0 -1193
- data/spec/hamster/list/break_spec.rbc +0 -1804
- data/spec/hamster/list/cadr_spec.rbc +0 -1065
- data/spec/hamster/list/chunk_spec.rbc +0 -920
- data/spec/hamster/list/clear_spec.rbc +0 -635
- data/spec/hamster/list/combinations_spec.rbc +0 -1308
- data/spec/hamster/list/compact_spec.rbc +0 -987
- data/spec/hamster/list/cons_spec.rbc +0 -853
- data/spec/hamster/list/construction_spec.rbc +0 -2532
- data/spec/hamster/list/copying_spec.rbc +0 -576
- data/spec/hamster/list/count_spec.rbc +0 -1216
- data/spec/hamster/list/cycle_spec.rbc +0 -1003
- data/spec/hamster/list/drop_spec.rbc +0 -949
- data/spec/hamster/list/drop_while_spec.rbc +0 -1289
- data/spec/hamster/list/each_slice_spec.rbc +0 -1659
- data/spec/hamster/list/each_spec.rbc +0 -1403
- data/spec/hamster/list/empty_spec.rbc +0 -947
- data/spec/hamster/list/eql_spec.rbc +0 -1669
- data/spec/hamster/list/filter_spec.rbc +0 -1379
- data/spec/hamster/list/find_spec.rbc +0 -1322
- data/spec/hamster/list/flatten_spec.rbc +0 -954
- data/spec/hamster/list/grep_spec.rbc +0 -1517
- data/spec/hamster/list/group_by_spec.rbc +0 -1536
- data/spec/hamster/list/head_spec.rbc +0 -948
- data/spec/hamster/list/include_spec.rbc +0 -1044
- data/spec/hamster/list/init_spec.rbc +0 -877
- data/spec/hamster/list/inits_spec.rbc +0 -988
- data/spec/hamster/list/inspect_spec.rbc +0 -855
- data/spec/hamster/list/intersperse_spec.rbc +0 -912
- data/spec/hamster/list/join_spec.rbc +0 -1357
- data/spec/hamster/list/last_spec.rbc +0 -856
- data/spec/hamster/list/map_spec.rbc +0 -1548
- data/spec/hamster/list/maximum_spec.rbc +0 -1498
- data/spec/hamster/list/minimum_spec.rbc +0 -1498
- data/spec/hamster/list/none_spec.rbc +0 -1647
- data/spec/hamster/list/one_spec.rbc +0 -1664
- data/spec/hamster/list/partition_spec.rbc +0 -1528
- data/spec/hamster/list/product_spec.rbc +0 -844
- data/spec/hamster/list/reduce_spec.rbc +0 -1943
- data/spec/hamster/list/remove_spec.rbc +0 -1518
- data/spec/hamster/list/reverse_spec.rbc +0 -1204
- data/spec/hamster/list/size_spec.rbc +0 -920
- data/spec/hamster/list/sorting_spec.rbc +0 -1612
- data/spec/hamster/list/span_spec.rbc +0 -1798
- data/spec/hamster/list/split_at_spec.rbc +0 -1139
- data/spec/hamster/list/sum_spec.rbc +0 -842
- data/spec/hamster/list/tail_spec.rbc +0 -994
- data/spec/hamster/list/tails_spec.rbc +0 -988
- data/spec/hamster/list/take_spec.rbc +0 -943
- data/spec/hamster/list/take_while_spec.rbc +0 -1399
- data/spec/hamster/list/to_a_spec.rbc +0 -1140
- data/spec/hamster/list/to_ary_spec.rbc +0 -1128
- data/spec/hamster/list/to_list_spec.rbc +0 -561
- data/spec/hamster/list/union_spec.rbc +0 -1147
- data/spec/hamster/list/uniq_spec.rbc +0 -1007
- data/spec/hamster/list/zip_spec.rbc +0 -1020
- data/spec/hamster/set/add_spec.rbc +0 -1051
- data/spec/hamster/set/all_spec.rbc +0 -1418
- data/spec/hamster/set/any_spec.rbc +0 -1449
- data/spec/hamster/set/compact_spec.rbc +0 -807
- data/spec/hamster/set/construction_spec.rbc +0 -426
- data/spec/hamster/set/copying_spec.rbc +0 -474
- data/spec/hamster/set/count_spec.rbc +0 -953
- data/spec/hamster/set/delete_spec.rbc +0 -958
- data/spec/hamster/set/each_spec.rbc +0 -909
- data/spec/hamster/set/empty_spec.rbc +0 -656
- data/spec/hamster/set/eql_spec.rbc +0 -1311
- data/spec/hamster/set/filter_spec.rbc +0 -1289
- data/spec/hamster/set/find_spec.rbc +0 -1017
- data/spec/hamster/set/grep_spec.rbc +0 -1181
- data/spec/hamster/set/group_by_spec.rbc +0 -1276
- data/spec/hamster/set/head_spec.rbc +0 -659
- data/spec/hamster/set/include_spec.rbc +0 -668
- data/spec/hamster/set/inspect_spec.rbc +0 -593
- data/spec/hamster/set/join_spec.rbc +0 -1075
- data/spec/hamster/set/map_spec.rbc +0 -1302
- data/spec/hamster/set/maximum_spec.rbc +0 -1334
- data/spec/hamster/set/minimum_spec.rbc +0 -1334
- data/spec/hamster/set/none_spec.rbc +0 -1348
- data/spec/hamster/set/one_spec.rbc +0 -1708
- data/spec/hamster/set/partition_spec.rbc +0 -1348
- data/spec/hamster/set/product_spec.rbc +0 -581
- data/spec/hamster/set/reduce_spec.rbc +0 -1198
- data/spec/hamster/set/remove_spec.rbc +0 -1295
- data/spec/hamster/set/size_spec.rbc +0 -533
- data/spec/hamster/set/sorting_spec.rbc +0 -1228
- data/spec/hamster/set/sum_spec.rbc +0 -579
- data/spec/hamster/set/to_a_spec.rbc +0 -774
- data/spec/hamster/set/to_list_spec.rbc +0 -862
- data/spec/hamster/set/to_set_spec.rbc +0 -561
- data/spec/hamster/set/uniq_spec.rbc +0 -479
- data/spec/hamster/stack/clear_spec.rbc +0 -635
- data/spec/hamster/stack/construction_spec.rbc +0 -872
- data/spec/hamster/stack/copying_spec.rbc +0 -561
- data/spec/hamster/stack/empty_spec.rbc +0 -577
- data/spec/hamster/stack/eql_spec.rbc +0 -1283
- data/spec/hamster/stack/inspect_spec.rbc +0 -592
- data/spec/hamster/stack/pop_spec.rbc +0 -1098
- data/spec/hamster/stack/push_spec.rbc +0 -853
- data/spec/hamster/stack/size_spec.rbc +0 -657
- data/spec/hamster/stack/to_a_spec.rbc +0 -801
- data/spec/hamster/stack/to_list_spec.rbc +0 -635
- data/spec/hamster/stack/top_spec.rbc +0 -683
- data/spec/hamster/trie/remove_spec.rbc +0 -40
- data/spec/hamster/tuple/copying_spec.rbc +0 -511
- data/spec/hamster/tuple/first_spec.rbc +0 -423
- data/spec/hamster/tuple/inspect_spec.rbc +0 -423
- data/spec/hamster/tuple/last_spec.rbc +0 -423
- data/spec/hamster/tuple/to_a_spec.rbc +0 -803
- data/spec/hamster/tuple/to_ary_spec.rbc +0 -908
- data/spec/spec_helper.rbc +0 -184
- data/tasks/spec.rbc +0 -202
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)
|
1
|
+
require File.expand_path('../../spec_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
require 'hamster/set'
|
4
4
|
|
@@ -40,7 +40,7 @@ describe Hamster::Set do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
it "returns
|
43
|
+
it "returns false if the block never returns true" do
|
44
44
|
pending do
|
45
45
|
@set.one? { |item| false }.should == false
|
46
46
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'hamster/tuple'
|
4
|
+
|
5
|
+
describe Hamster::Tuple do
|
6
|
+
|
7
|
+
[:eql?, :==].each do |method|
|
8
|
+
|
9
|
+
describe "##{method}" do
|
10
|
+
|
11
|
+
describe "returns false when comparing with" do
|
12
|
+
|
13
|
+
before do
|
14
|
+
@tuple = Hamster::Tuple.new("A", "B", "C")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "an array with the same values" do
|
18
|
+
@tuple.send(method, ["A", "B", "C"]).should == false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "an aribtrary object" do
|
22
|
+
@tuple.send(method, Object.new).should == false
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
[
|
28
|
+
[[], [], true],
|
29
|
+
[[], [nil], false],
|
30
|
+
[["A"], [], false],
|
31
|
+
[["A"], ["A"], true],
|
32
|
+
[["A"], ["B"], false],
|
33
|
+
[["A", "B"], ["A"], false],
|
34
|
+
[["A", "B", "C"], ["A", "B", "C"], true],
|
35
|
+
[["C", "A", "B"], ["A", "B", "C"], false],
|
36
|
+
].each do |a, b, expected|
|
37
|
+
|
38
|
+
describe "returns #{expected.inspect}" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
@a = Hamster::Tuple.new(*a)
|
42
|
+
@b = Hamster::Tuple.new(*b)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "for #{a.inspect} and #{b.inspect}" do
|
46
|
+
@a.send(method, @b).should == expected
|
47
|
+
end
|
48
|
+
|
49
|
+
it "for #{b.inspect} and #{a.inspect}" do
|
50
|
+
@b.send(method, @a).should == expected
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|