mail 2.1.5.2 → 2.1.5.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mail might be problematic. Click here for more details.

Files changed (134) hide show
  1. data/CHANGELOG.rdoc +6 -0
  2. data/Rakefile +2 -1
  3. data/lib/mail.rb +0 -1
  4. data/lib/mail/elements.rb +0 -1
  5. data/lib/mail/utilities.rb +1 -1
  6. data/lib/mail/version.rb +1 -1
  7. data/lib/tasks/treetop.rake +4 -4
  8. metadata +17 -129
  9. data/lib/mail/vendor/treetop-1.4.4/History.txt +0 -18
  10. data/lib/mail/vendor/treetop-1.4.4/LICENSE +0 -19
  11. data/lib/mail/vendor/treetop-1.4.4/README.md +0 -164
  12. data/lib/mail/vendor/treetop-1.4.4/Rakefile +0 -28
  13. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Preferences/Comments.tmPreferences +0 -22
  14. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +0 -20
  15. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +0 -18
  16. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/designable.nib +0 -1524
  17. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/keyedobjects.nib +0 -0
  18. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/syntax_tree_viewer.rb +0 -117
  19. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +0 -278
  20. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/info.plist +0 -10
  21. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar.gnuplot +0 -15
  22. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar.treetop +0 -16
  23. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar_benchmark.rb +0 -107
  24. data/lib/mail/vendor/treetop-1.4.4/bin/tt +0 -112
  25. data/lib/mail/vendor/treetop-1.4.4/doc/contributing_and_planned_features.markdown +0 -103
  26. data/lib/mail/vendor/treetop-1.4.4/doc/grammar_composition.markdown +0 -65
  27. data/lib/mail/vendor/treetop-1.4.4/doc/index.markdown +0 -90
  28. data/lib/mail/vendor/treetop-1.4.4/doc/pitfalls_and_advanced_techniques.markdown +0 -51
  29. data/lib/mail/vendor/treetop-1.4.4/doc/semantic_interpretation.markdown +0 -189
  30. data/lib/mail/vendor/treetop-1.4.4/doc/site.rb +0 -112
  31. data/lib/mail/vendor/treetop-1.4.4/doc/sitegen.rb +0 -65
  32. data/lib/mail/vendor/treetop-1.4.4/doc/syntactic_recognition.markdown +0 -100
  33. data/lib/mail/vendor/treetop-1.4.4/doc/using_in_ruby.markdown +0 -28
  34. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic.rb +0 -551
  35. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic.treetop +0 -97
  36. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic_node_classes.rb +0 -7
  37. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic_test.rb +0 -54
  38. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus +0 -0
  39. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus.rb +0 -718
  40. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus.treetop +0 -132
  41. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus_node_classes.rb +0 -5
  42. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus_test.rb +0 -89
  43. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/test_helper.rb +0 -18
  44. data/lib/mail/vendor/treetop-1.4.4/lib/treetop.rb +0 -3
  45. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -42
  46. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler.rb +0 -7
  47. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/grammar_compiler.rb +0 -44
  48. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/lexical_address_space.rb +0 -17
  49. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/metagrammar.rb +0 -3366
  50. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/metagrammar.treetop +0 -436
  51. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes.rb +0 -19
  52. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
  53. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
  54. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/character_class.rb +0 -28
  55. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/choice.rb +0 -31
  56. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
  57. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/grammar.rb +0 -28
  58. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
  59. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
  60. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/optional.rb +0 -19
  61. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
  62. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -146
  63. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -58
  64. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/predicate.rb +0 -45
  65. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/predicate_block.rb +0 -16
  66. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/repetition.rb +0 -55
  67. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/sequence.rb +0 -71
  68. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/terminal.rb +0 -20
  69. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
  70. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
  71. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/ruby_builder.rb +0 -113
  72. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/polyglot.rb +0 -9
  73. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/ruby_extensions.rb +0 -1
  74. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/ruby_extensions/string.rb +0 -42
  75. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime.rb +0 -6
  76. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/compiled_parser.rb +0 -110
  77. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list.rb +0 -3
  78. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
  79. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
  80. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
  81. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/syntax_node.rb +0 -114
  82. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
  83. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
  84. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/version.rb +0 -9
  85. data/lib/mail/vendor/treetop-1.4.4/script/generate_metagrammar.rb +0 -13
  86. data/lib/mail/vendor/treetop-1.4.4/script/svnadd +0 -11
  87. data/lib/mail/vendor/treetop-1.4.4/script/svnrm +0 -11
  88. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/and_predicate_spec.rb +0 -36
  89. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/anything_symbol_spec.rb +0 -44
  90. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/character_class_spec.rb +0 -276
  91. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/choice_spec.rb +0 -80
  92. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/circular_compilation_spec.rb +0 -30
  93. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  94. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/grammar_compiler_spec.rb +0 -84
  95. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/grammar_spec.rb +0 -41
  96. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/multibyte_chars_spec.rb +0 -38
  97. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  98. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/not_predicate_spec.rb +0 -38
  99. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/one_or_more_spec.rb +0 -35
  100. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/optional_spec.rb +0 -37
  101. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/parenthesized_expression_spec.rb +0 -19
  102. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/parsing_rule_spec.rb +0 -61
  103. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/repeated_subrule_spec.rb +0 -29
  104. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/semantic_predicate_spec.rb +0 -175
  105. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/sequence_spec.rb +0 -115
  106. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/terminal_spec.rb +0 -81
  107. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/terminal_symbol_spec.rb +0 -37
  108. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar.treetop +0 -7
  109. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar.tt +0 -7
  110. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar_do.treetop +0 -7
  111. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/tt_compiler_spec.rb +0 -216
  112. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/zero_or_more_spec.rb +0 -56
  113. data/lib/mail/vendor/treetop-1.4.4/spec/composition/a.treetop +0 -11
  114. data/lib/mail/vendor/treetop-1.4.4/spec/composition/b.treetop +0 -11
  115. data/lib/mail/vendor/treetop-1.4.4/spec/composition/c.treetop +0 -10
  116. data/lib/mail/vendor/treetop-1.4.4/spec/composition/d.treetop +0 -10
  117. data/lib/mail/vendor/treetop-1.4.4/spec/composition/f.treetop +0 -17
  118. data/lib/mail/vendor/treetop-1.4.4/spec/composition/grammar_composition_spec.rb +0 -40
  119. data/lib/mail/vendor/treetop-1.4.4/spec/composition/subfolder/e_includes_c.treetop +0 -15
  120. data/lib/mail/vendor/treetop-1.4.4/spec/ruby_extensions/string_spec.rb +0 -32
  121. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/compiled_parser_spec.rb +0 -101
  122. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  123. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  124. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
  125. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  126. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  127. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  128. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
  129. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -163
  130. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
  131. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/syntax_node_spec.rb +0 -77
  132. data/lib/mail/vendor/treetop-1.4.4/spec/spec_helper.rb +0 -110
  133. data/lib/mail/vendor/treetop-1.4.4/treetop.gemspec +0 -18
  134. data/lib/mail/vendor/treetop.rb +0 -2
@@ -1,385 +0,0 @@
1
- require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
2
-
3
- describe "it is non-empty", :shared => true do
4
- specify "#empty? returns false" do
5
- list.should_not be_empty
6
- end
7
- end
8
-
9
- describe "#nodes is an array of the three inserted nodes in key order", :shared => true do
10
- specify "#nodes is an array of the three inserted nodes in key order" do
11
- list.nodes.should == inserted_nodes.sort_by(&:key)
12
- end
13
- end
14
-
15
- describe "it has nil forward pointers", :shared => true do
16
- it "has nil forward pointers" do
17
- inserted_node.forward.each do |next_pointer|
18
- next_pointer.should be_nil
19
- end
20
- end
21
- end
22
-
23
- describe IntervalSkipList do
24
- attr_reader :list
25
-
26
- before do
27
- @list = IntervalSkipList.new
28
- end
29
-
30
- describe " when nothing has been inserted" do
31
- specify "#empty? returns true" do
32
- list.should be_empty
33
- end
34
-
35
- specify "#nodes returns an empty array" do
36
- list.nodes.should == []
37
- end
38
-
39
- describe "#head" do
40
- attr_reader :head
41
-
42
- before do
43
- @head = list.head
44
- end
45
-
46
- it "#has a height of #max_height" do
47
- head.height.should == list.max_height
48
- end
49
-
50
- it "has nil forward pointers" do
51
- 0.upto(list.max_height - 1) do |i|
52
- head.forward[i].should be_nil
53
- end
54
- end
55
- end
56
- end
57
-
58
- describe " when 1 has been inserted" do
59
- attr_reader :inserted_node, :inserted_nodes
60
-
61
- def expected_node_heights
62
- [1]
63
- end
64
-
65
- it_should_behave_like "#next_node_height is deterministic"
66
-
67
- before do
68
- @inserted_node = list.insert_node(1)
69
- @inserted_nodes = [@inserted_node]
70
- end
71
-
72
- it_should_behave_like "it is non-empty"
73
- it_should_behave_like "#nodes is an array of the three inserted nodes in key order"
74
-
75
- describe "#head" do
76
- attr_reader :head
77
-
78
- before do
79
- @head = list.head
80
- end
81
-
82
- it "has inserted_node.height forward pointers pointing at the inserted node" do
83
- 0.upto(inserted_node.height - 1) do |i|
84
- head.forward[i].should == inserted_node
85
- end
86
- end
87
-
88
- it "has the rest of its forward pointers pointing at nil" do
89
- inserted_node.height.upto(list.max_height - 1) do |i|
90
- head.forward[i].should == nil
91
- end
92
- end
93
- end
94
-
95
- describe "the inserted node" do
96
- it_should_behave_like "it has nil forward pointers"
97
-
98
- it "has a height of the expected_node_heights.first" do
99
- inserted_node.height.should == expected_node_heights.first
100
- end
101
-
102
- it "has a key of 1" do
103
- inserted_node.key.should == 1
104
- end
105
- end
106
-
107
- describe "and subsequently deleted" do
108
- before do
109
- list.delete_node(1)
110
- end
111
-
112
- specify "#empty? returns true" do
113
- list.should be_empty
114
- end
115
- end
116
- end
117
-
118
- describe " when 1 and 3 have been inserted in order" do
119
- attr_reader :inserted_nodes
120
-
121
- def expected_node_heights
122
- [1, 2]
123
- end
124
-
125
- it_should_behave_like "#next_node_height is deterministic"
126
-
127
- before do
128
- @inserted_nodes = []
129
- inserted_nodes << list.insert_node(1)
130
- inserted_nodes << list.insert_node(3)
131
- end
132
-
133
- it_should_behave_like "it is non-empty"
134
- it_should_behave_like "#nodes is an array of the three inserted nodes in key order"
135
-
136
- describe "the first inserted node" do
137
- attr_reader :inserted_node
138
-
139
- before do
140
- @inserted_node = inserted_nodes[0]
141
- end
142
-
143
- it "has a key of 1" do
144
- inserted_node.key.should == 1
145
- end
146
-
147
- it "has a height of the first expected node height" do
148
- inserted_node.height.should == expected_node_heights[0]
149
- end
150
-
151
- it "has its single forward pointer pointing at the second inserted node" do
152
- inserted_node.forward[0].should == inserted_nodes[1]
153
- end
154
- end
155
-
156
- describe "the second inserted node" do
157
- attr_reader :inserted_node
158
-
159
- before do
160
- @inserted_node = inserted_nodes[1]
161
- end
162
-
163
- it_should_behave_like "it has nil forward pointers"
164
-
165
- it "has a key of 3" do
166
- inserted_node.key.should == 3
167
- end
168
-
169
- it "has a height of the second expected node height" do
170
- inserted_node.height.should == expected_node_heights[1]
171
- end
172
- end
173
-
174
- describe "and 1 is subsequently deleted" do
175
- before do
176
- list.delete_node(1)
177
- end
178
-
179
- describe "the remaining node" do
180
- attr_reader :inserted_node
181
-
182
- before do
183
- @inserted_node = inserted_nodes[1]
184
- end
185
-
186
- it "is the first node in the list" do
187
- inserted_node.should == list.nodes[0]
188
- end
189
-
190
- it_should_behave_like "it has nil forward pointers"
191
- end
192
- end
193
-
194
- describe "and 3 is subsequently deleted" do
195
- before do
196
- list.delete_node(3)
197
- end
198
-
199
- describe "the remaining node" do
200
- attr_reader :inserted_node
201
-
202
- before do
203
- @inserted_node = inserted_nodes[0]
204
- end
205
-
206
- it "is the first node in the list" do
207
- inserted_node.should == list.nodes[0]
208
- end
209
-
210
- it_should_behave_like "it has nil forward pointers"
211
- end
212
- end
213
- end
214
-
215
- describe " when 1, 3 and 7 have been inserted in order" do
216
- attr_reader :inserted_nodes
217
-
218
- def expected_node_heights
219
- [1, 2, 1]
220
- end
221
-
222
- it_should_behave_like "#next_node_height is deterministic"
223
-
224
- before do
225
- @inserted_nodes = []
226
- inserted_nodes << list.insert_node(1)
227
- inserted_nodes << list.insert_node(3)
228
- inserted_nodes << list.insert_node(7)
229
- end
230
-
231
- it_should_behave_like "it is non-empty"
232
- it_should_behave_like "#nodes is an array of the three inserted nodes in key order"
233
-
234
- describe "the first inserted node" do
235
- attr_reader :inserted_node
236
-
237
- before do
238
- @inserted_node = inserted_nodes[0]
239
- end
240
-
241
- it "has a key of 1" do
242
- inserted_node.key.should == 1
243
- end
244
-
245
- it "has a height of the first expected node height" do
246
- inserted_node.height.should == expected_node_heights[0]
247
- end
248
-
249
- it "has its single forward pointer pointing at the second inserted node" do
250
- inserted_node.forward[0].should == inserted_nodes[1]
251
- end
252
- end
253
-
254
- describe "the second inserted node" do
255
- attr_reader :inserted_node
256
-
257
- before do
258
- @inserted_node = inserted_nodes[1]
259
- end
260
-
261
- it "has a key of 3" do
262
- inserted_node.key.should == 3
263
- end
264
-
265
- it "has a height of the second expected node height" do
266
- inserted_node.height.should == expected_node_heights[1]
267
- end
268
-
269
- it "has a forward pointer at level 0 pointing to the third inserted node" do
270
- inserted_node.forward[0].should == inserted_nodes[2]
271
- end
272
-
273
- it "has nil forward pointer at level 1" do
274
- inserted_node.forward[1].should be_nil
275
- end
276
- end
277
-
278
- describe "the third inserted node" do
279
- attr_reader :inserted_node
280
-
281
- before do
282
- @inserted_node = inserted_nodes[2]
283
- end
284
-
285
- it_should_behave_like "it has nil forward pointers"
286
-
287
- it "has a key of 3" do
288
- inserted_node.key.should == 7
289
- end
290
-
291
- it "has a height of the third expected node height" do
292
- inserted_node.height.should == expected_node_heights[2]
293
- end
294
- end
295
-
296
- describe "and 3 is subsequently deleted" do
297
- before do
298
- list.delete_node(3)
299
- end
300
-
301
- specify "#head points at nil at levels 1 and 2" do
302
- list.head.forward[1].should be_nil
303
- list.head.forward[2].should be_nil
304
- end
305
-
306
- specify "#nodes contains the remaining nodes in order" do
307
- list.nodes.should == [inserted_nodes[0], inserted_nodes[2]]
308
- end
309
- end
310
- end
311
-
312
- describe " when 7, 1 and 3 have been inserted in order" do
313
- attr_reader :inserted_nodes
314
-
315
- def expected_node_heights
316
- [1, 1, 2]
317
- end
318
-
319
- it_should_behave_like "#next_node_height is deterministic"
320
-
321
- before do
322
- @inserted_nodes = []
323
- inserted_nodes << list.insert_node(7)
324
- inserted_nodes << list.insert_node(1)
325
- inserted_nodes << list.insert_node(3)
326
- end
327
-
328
- it_should_behave_like "it is non-empty"
329
- it_should_behave_like "#nodes is an array of the three inserted nodes in key order"
330
-
331
- describe "the first inserted node" do
332
- attr_reader :inserted_node
333
-
334
- before do
335
- @inserted_node = inserted_nodes[0]
336
- end
337
-
338
- it_should_behave_like "it has nil forward pointers"
339
-
340
- it "has a key of 7" do
341
- inserted_node.key.should == 7
342
- end
343
-
344
- it "has a height of the first expected node height" do
345
- inserted_node.height.should == expected_node_heights[0]
346
- end
347
- end
348
-
349
- describe "the second inserted node" do
350
- attr_reader :inserted_node
351
-
352
- before do
353
- @inserted_node = inserted_nodes[1]
354
- end
355
-
356
- it "has a key of 1" do
357
- inserted_node.key.should == 1
358
- end
359
-
360
- it "has a height of the second expected node height" do
361
- inserted_node.height.should == expected_node_heights[1]
362
- end
363
-
364
- it "has a forward pointer at level 0 pointing to the second node in the list" do
365
- inserted_node.forward[0].should == list.nodes[1]
366
- end
367
- end
368
-
369
- describe "the third inserted node" do
370
- attr_reader :inserted_node
371
-
372
- before do
373
- @inserted_node = inserted_nodes[2]
374
- end
375
-
376
- it "has a key of 3" do
377
- inserted_node.key.should == 3
378
- end
379
-
380
- it "has a height of the third expected node height" do
381
- inserted_node.height.should == expected_node_heights[2]
382
- end
383
- end
384
- end
385
- end
@@ -1,660 +0,0 @@
1
- require 'runtime/interval_skip_list/spec_helper'
2
-
3
- describe IntervalSkipList, " when #next_node_height returns 1, 3, 2, 3, 1 in order" do
4
- include IntervalSkipListSpecHelper
5
- attr_reader :list, :node
6
-
7
- before do
8
- @list = IntervalSkipList.new
9
- end
10
-
11
- it_should_behave_like "#next_node_height is deterministic"
12
-
13
- def expected_node_heights
14
- [1, 3, 2, 3, 1]
15
- end
16
-
17
- describe ", when :a is inserted on 1..7" do
18
- before do
19
- list.insert(1..7, :a)
20
- end
21
-
22
- describe ", #containing" do
23
- it "returns only :a from 2 through 6" do
24
- (2..6).should contain_marker(:a)
25
- end
26
-
27
- it "returns nothing at 1 and 7" do
28
- list.containing(1).should be_empty
29
- list.containing(7).should be_empty
30
- end
31
- end
32
-
33
- describe " #nodes[0]" do
34
- before do
35
- @node = list.nodes[0]
36
- end
37
-
38
- it "has a key of 1 and height of 1" do
39
- node.key.should == 1
40
- node.height.should == 1
41
- end
42
-
43
- it "has :a as its only marker at level 0" do
44
- node.forward_markers[0].should have_marker(:a)
45
- end
46
-
47
- it "has no markers" do
48
- node.markers.should be_empty
49
- end
50
-
51
- it "is an endpoint of only :a" do
52
- node.endpoint_of.should have_marker(:a)
53
- end
54
- end
55
-
56
- describe " #nodes[1]" do
57
- before do
58
- @node = list.nodes[1]
59
- end
60
-
61
- it "has a key of 7 and height of 3" do
62
- node.key.should == 7
63
- node.height.should == 3
64
- end
65
-
66
- it "has no forward markers at any level" do
67
- node.forward_markers[0].should be_empty
68
- node.forward_markers[1].should be_empty
69
- node.forward_markers[2].should be_empty
70
- end
71
-
72
- it "has :a as its only marker" do
73
- node.markers.should have_marker(:a)
74
- end
75
-
76
- it "is an endpoint of only :a" do
77
- node.endpoint_of.should have_marker(:a)
78
- end
79
- end
80
-
81
- describe ", and then :b is inserted on 1..5" do
82
- before do
83
- list.insert(1..5, :b)
84
- end
85
-
86
- describe ", #containing" do
87
- it "returns only :a and :b from 2 through 4" do
88
- (2..4).should contain_markers(:a, :b)
89
- end
90
-
91
- it "returns only :a from 5 through 6" do
92
- (5..6).should contain_marker(:a)
93
- end
94
-
95
- it "returns nothing at 1 and 7" do
96
- list.containing(1).should be_empty
97
- list.containing(7).should be_empty
98
- end
99
- end
100
-
101
- describe " #nodes[0]" do
102
- before do
103
- @node = list.nodes[0]
104
- end
105
-
106
- it "has a key of 1 and height of 1" do
107
- node.key.should == 1
108
- node.height.should == 1
109
- end
110
-
111
- it "has :a and :b as its only forward markers at level 0" do
112
- node.forward_markers[0].should have_markers(:a, :b)
113
- end
114
-
115
- it "has no markers" do
116
- node.markers.should be_empty
117
- end
118
-
119
- it "is an endpoint of only :a and :b" do
120
- node.endpoint_of.should have_markers(:a, :b)
121
- end
122
- end
123
-
124
- describe " #nodes[1]" do
125
- before do
126
- @node = list.nodes[1]
127
- end
128
-
129
- it "has a key of 5 and height of 2" do
130
- node.key.should == 5
131
- node.height.should == 2
132
- end
133
-
134
- it "has :a as its only forward marker at level 1" do
135
- node.forward_markers[1].should have_marker(:a)
136
- end
137
-
138
- it "has no forward markers at level 0" do
139
- node.forward_markers[0].should be_empty
140
- end
141
-
142
- it "has :a and :b as its only markers" do
143
- node.markers.should have_markers(:a, :b)
144
- end
145
-
146
- it "is an endpoint of only :b" do
147
- node.endpoint_of.should have_marker(:b)
148
- end
149
- end
150
-
151
- describe " #nodes[2]" do
152
- before do
153
- @node = list.nodes[2]
154
- end
155
-
156
- it "has a key of 7 and height of 3" do
157
- node.key.should == 7
158
- node.height.should == 3
159
- end
160
-
161
- it "has no forward markers at any level" do
162
- node.forward_markers[0].should be_empty
163
- node.forward_markers[1].should be_empty
164
- node.forward_markers[2].should be_empty
165
- end
166
-
167
- it "has :a its only marker" do
168
- node.markers.should have_marker(:a)
169
- end
170
-
171
- it "is an endpoint of only :a" do
172
- node.endpoint_of.should have_marker(:a)
173
- end
174
- end
175
-
176
- describe ", and then :c is inserted on 1..3" do
177
- before do
178
- list.insert(1..3, :c)
179
- end
180
-
181
- describe ", #containing" do
182
- it "returns only :a, :b, and :c for 2" do
183
- (2..2).should contain_markers(:a, :b, :c)
184
- end
185
-
186
- it "returns only :a, :b from 3..4" do
187
- (3..4).should contain_markers(:a, :b)
188
- end
189
-
190
- it "returns only :a from 5..6" do
191
- (5..6).should contain_markers(:a)
192
- end
193
-
194
- it "returns nothing at 1 and 7" do
195
- list.containing(1).should be_empty
196
- list.containing(7).should be_empty
197
- end
198
- end
199
-
200
- describe " #nodes[0]" do
201
- before do
202
- @node = list.nodes[0]
203
- end
204
-
205
- it "has a key of 1 and height of 1" do
206
- node.key.should == 1
207
- node.height.should == 1
208
- end
209
-
210
- it "has :a, :b, :c as its only forward markers at level 0" do
211
- node.forward_markers[0].should have_markers(:a, :b, :c)
212
- end
213
-
214
- it "has no markers" do
215
- node.markers.should be_empty
216
- end
217
-
218
- it "is an endpoint of only :a, :b, :c" do
219
- node.endpoint_of.should have_markers(:a, :b, :c)
220
- end
221
- end
222
-
223
- describe " #nodes[1]" do
224
- before do
225
- @node = list.nodes[1]
226
- end
227
-
228
- it "has a key of 3 and height of 3" do
229
- node.key.should == 3
230
- node.height.should == 3
231
- end
232
-
233
- it "has :a as its only forward marker at level 2" do
234
- node.forward_markers[2].should have_marker(:a)
235
- end
236
-
237
- it "has :b as its only forward marker at level 1" do
238
- node.forward_markers[1].should have_marker(:b)
239
- end
240
-
241
- it "has no forward markers at level 0" do
242
- node.forward_markers[0].should be_empty
243
- end
244
-
245
- it "has :a, :b, and :c as its only markers" do
246
- node.markers.should have_markers(:a, :b, :c)
247
- end
248
-
249
- it "is an endpoint of only :c" do
250
- node.endpoint_of.should have_marker(:c)
251
- end
252
- end
253
-
254
- describe " #nodes[2]" do
255
- before do
256
- @node = list.nodes[2]
257
- end
258
-
259
- it "has a key of 5 and height of 2" do
260
- node.key.should == 5
261
- node.height.should == 2
262
- end
263
-
264
- it "has no forward markers at any level" do
265
- node.forward_markers[0].should be_empty
266
- node.forward_markers[1].should be_empty
267
- end
268
-
269
- it "has :b as its only markers" do
270
- node.markers.should have_marker(:b)
271
- end
272
-
273
- it "is an endpoint of only :b" do
274
- node.endpoint_of.should have_marker(:b)
275
- end
276
- end
277
-
278
- describe " #nodes[3]" do
279
- before do
280
- @node = list.nodes[3]
281
- end
282
-
283
- it "has a key of 7 and height of 3" do
284
- node.key.should == 7
285
- node.height.should == 3
286
- end
287
-
288
- it "has no forward markers at any level" do
289
- node.forward_markers[0].should be_empty
290
- node.forward_markers[1].should be_empty
291
- node.forward_markers[2].should be_empty
292
- end
293
-
294
- it "has :a as its only marker" do
295
- node.markers.should have_marker(:a)
296
- end
297
-
298
- it "is an endpoint of only :a" do
299
- node.endpoint_of.should have_marker(:a)
300
- end
301
- end
302
-
303
- describe ", and then :d is inserted on 1..9" do
304
- before do
305
- list.insert(1..9, :d)
306
- end
307
-
308
- describe ", #containing" do
309
- it "returns only :a, :b, :c, and :d for 2" do
310
- (2..2).should contain_markers(:a, :b, :c, :d)
311
- end
312
-
313
- it "returns only :a, :b from 3..4" do
314
- (3..4).should contain_markers(:a, :b, :d)
315
- end
316
-
317
- it "returns only :a from 5..6" do
318
- (5..6).should contain_markers(:a, :d)
319
- end
320
-
321
- it "returns only :a from 7..8" do
322
- (7..8).should contain_markers(:d)
323
- end
324
-
325
- it "returns nothing at 1 and 9" do
326
- list.containing(1).should be_empty
327
- list.containing(9).should be_empty
328
- end
329
-
330
- it "returns nothing for -1, 0, and 10" do
331
- list.containing(-1).should be_empty
332
- list.containing(0).should be_empty
333
- list.containing(10).should be_empty
334
- end
335
- end
336
-
337
- describe " #nodes[0]" do
338
- before do
339
- @node = list.nodes[0]
340
- end
341
-
342
- it "has a key of 1 and height of 1" do
343
- node.key.should == 1
344
- node.height.should == 1
345
- end
346
-
347
- it "has :a, :b, :c, :d as its only forward markers at level 0" do
348
- node.forward_markers[0].should have_markers(:a, :b, :c, :d)
349
- end
350
-
351
- it "has no markers" do
352
- node.markers.should be_empty
353
- end
354
-
355
- it "is an endpoint of only :a, :b, :c, and :d" do
356
- node.endpoint_of.should have_markers(:a, :b, :c, :d)
357
- end
358
- end
359
-
360
- describe " #nodes[1]" do
361
- before do
362
- @node = list.nodes[1]
363
- end
364
-
365
- it "has a key of 3 and height of 3" do
366
- node.key.should == 3
367
- node.height.should == 3
368
- end
369
-
370
- it "has :a and :d as its only forward markers at level 2" do
371
- node.forward_markers[2].should have_markers(:a, :d)
372
- end
373
-
374
- it "has :b as its only marker at level 1" do
375
- node.forward_markers[1].should have_marker(:b)
376
- end
377
-
378
- it "has no forward markers at level 0" do
379
- node.forward_markers[0].should be_empty
380
- end
381
-
382
- it "has :a, :b, :c, :d as its only markers" do
383
- node.markers.should have_markers(:a, :b, :c, :d)
384
- end
385
-
386
- it "is an endpoint of only :c" do
387
- node.endpoint_of.should have_marker(:c)
388
- end
389
- end
390
-
391
- describe " #nodes[2]" do
392
- before do
393
- @node = list.nodes[2]
394
- end
395
-
396
- it "has a key of 5 and height of 2" do
397
- node.key.should == 5
398
- node.height.should == 2
399
- end
400
-
401
- it "has no markers on any level" do
402
- node.forward_markers[0].should be_empty
403
- node.forward_markers[1].should be_empty
404
- end
405
-
406
- it "has :b as its only marker" do
407
- node.markers.should have_marker(:b)
408
- end
409
-
410
- it "is an endpoint of only :b" do
411
- node.endpoint_of.should have_marker(:b)
412
- end
413
- end
414
-
415
- describe " #nodes[3]" do
416
- before do
417
- @node = list.nodes[3]
418
- end
419
-
420
- it "has a key of 7 and height of 3" do
421
- node.key.should == 7
422
- node.height.should == 3
423
- end
424
-
425
- it "has :d as its only marker at level 0" do
426
- node.forward_markers[0].should have_marker(:d)
427
- end
428
-
429
- it "has no forward markers at levels 1 and 2" do
430
- node.forward_markers[1].should be_empty
431
- node.forward_markers[2].should be_empty
432
- end
433
-
434
- it "has :a, :d as its only markers" do
435
- node.markers.should have_markers(:a, :d)
436
- end
437
-
438
- it "is an endpoint of only :a" do
439
- node.endpoint_of.should have_marker(:a)
440
- end
441
- end
442
-
443
- describe " #nodes[4]" do
444
- before do
445
- @node = list.nodes[4]
446
- end
447
-
448
- it "has a key of 9 and height of 1" do
449
- node.key.should == 9
450
- node.height.should == 1
451
- end
452
-
453
- it "has no forward markers at level 0" do
454
- node.forward_markers[0].should be_empty
455
- end
456
-
457
- it "has :d as its only marker" do
458
- node.markers.should have_marker(:d)
459
- end
460
-
461
- it "is an endpoint of only :d" do
462
- node.endpoint_of.should have_marker(:d)
463
- end
464
- end
465
-
466
- describe ", and then :d is deleted" do
467
- before do
468
- list.delete(:d)
469
- end
470
-
471
- it "has only 4 nodes" do
472
- list.nodes.size.should == 4
473
- end
474
-
475
- describe " #nodes[0]" do
476
- before do
477
- @node = list.nodes[0]
478
- end
479
-
480
- it "has a key of 1 and height of 1" do
481
- node.key.should == 1
482
- node.height.should == 1
483
- end
484
-
485
- it "has :a, :b, and :c as its only forward markers at level 0" do
486
- node.forward_markers[0].should have_markers(:a, :b, :c)
487
- end
488
- end
489
-
490
- describe " #nodes[1]" do
491
- before do
492
- @node = list.nodes[1]
493
- end
494
-
495
- it "has a key of 3 and height of 3" do
496
- node.key.should == 3
497
- node.height.should == 3
498
- end
499
-
500
- it "has :a as its only forward marker at level 2" do
501
- node.forward_markers[2].should have_marker(:a)
502
- end
503
-
504
- it "has :b as its only forward marker at level 1" do
505
- node.forward_markers[1].should have_marker(:b)
506
- end
507
-
508
- it "has no forward markers at level 0" do
509
- node.forward_markers[0].should be_empty
510
- end
511
-
512
- it "has :a, :b, and :c as its only markers" do
513
- node.markers.should have_markers(:a, :b, :c)
514
- end
515
-
516
- it "is the endpoint of only :c" do
517
- node.endpoint_of.should have_marker(:c)
518
- end
519
- end
520
-
521
- describe " #nodes[2]" do
522
- before do
523
- @node = list.nodes[2]
524
- end
525
-
526
- it "has a key of 5 and height of 2" do
527
- node.key.should == 5
528
- node.height.should == 2
529
- end
530
-
531
- it "has no forward markers at any level" do
532
- node.forward_markers[0].should be_empty
533
- node.forward_markers[1].should be_empty
534
- end
535
-
536
- it "has :b as its only marker" do
537
- node.markers.should have_marker(:b)
538
- end
539
-
540
- it "is the endpoint of only :b" do
541
- node.endpoint_of.should have_marker(:b)
542
- end
543
- end
544
-
545
- describe " #nodes[3]" do
546
- before do
547
- @node = list.nodes[3]
548
- end
549
-
550
- it "has a key of 7 and height of 3" do
551
- node.key.should == 7
552
- node.height.should == 3
553
- end
554
-
555
- it "has no forward markers at any level" do
556
- node.forward_markers[0].should be_empty
557
- node.forward_markers[1].should be_empty
558
- node.forward_markers[2].should be_empty
559
- end
560
-
561
- it "has :a as its only marker" do
562
- node.markers.should have_marker(:a)
563
- end
564
-
565
- it "is the endpoint of only :a" do
566
- node.endpoint_of.should have_marker(:a)
567
- end
568
- end
569
-
570
- describe ", and then :c is deleted" do
571
- before do
572
- list.delete(:c)
573
- end
574
-
575
- it "has only 3 nodes" do
576
- list.nodes.size.should == 3
577
- end
578
-
579
- describe " #nodes[0]" do
580
- before do
581
- @node = list.nodes[0]
582
- end
583
-
584
- it "has a key of 1 and height of 1" do
585
- node.key.should == 1
586
- node.height.should == 1
587
- end
588
-
589
- it "has :a and :b as its only forward markers at level 0" do
590
- node.forward_markers[0].should have_markers(:a, :b)
591
- end
592
-
593
- it "has no markers" do
594
- node.markers.should be_empty
595
- end
596
-
597
- it "is an endpoint of only :a and :b" do
598
- node.endpoint_of.should have_markers(:a, :b)
599
- end
600
- end
601
-
602
- describe " #nodes[1]" do
603
- before do
604
- @node = list.nodes[1]
605
- end
606
-
607
- it "has a key of 5 and height of 2" do
608
- node.key.should == 5
609
- node.height.should == 2
610
- end
611
-
612
- it "has :a as its only forward marker at level 1" do
613
- node.forward_markers[1].should have_marker(:a)
614
- end
615
-
616
- it "has no forward markers at level 0" do
617
- node.forward_markers[0].should be_empty
618
- end
619
-
620
- it "has :a and :b as its only markers" do
621
- node.markers.should have_markers(:a, :b)
622
- end
623
-
624
- it "is an endpoint of only :b" do
625
- node.endpoint_of.should have_marker(:b)
626
- end
627
- end
628
-
629
- describe " #nodes[2]" do
630
- before do
631
- @node = list.nodes[2]
632
- end
633
-
634
- it "has a key of 7 and height of 3" do
635
- node.key.should == 7
636
- node.height.should == 3
637
- end
638
-
639
- it "has no forward markers at any level" do
640
- node.forward_markers[0].should be_empty
641
- node.forward_markers[1].should be_empty
642
- node.forward_markers[2].should be_empty
643
- end
644
-
645
- it "has :a its only marker" do
646
- node.markers.should have_marker(:a)
647
- end
648
-
649
- it "is an endpoint of only :a" do
650
- node.endpoint_of.should have_marker(:a)
651
- end
652
- end
653
- end
654
- end
655
- end
656
- end
657
- end
658
- end
659
- end
660
-