crafting_table 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.asc +11 -0
- data.tar.gz.asc +11 -0
- data/.gitignore +0 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/LICENSE +14 -0
- data/Rakefile +0 -0
- data/crafting_table.gemspec +19 -0
- data/data/items/thermal_expansion.yml +64 -0
- data/data/items/vanilla.yml +1152 -0
- data/data/recipes/thermal_expansion.yml +97 -0
- data/data/recipes/vanilla.yml +25 -0
- data/data/test/items/vanilla.yml +1149 -0
- data/data/test/recipes/vanilla.yml +25 -0
- data/examples/interactive_table.rb +98 -0
- data/features/item_differentiation.feature +18 -0
- data/features/loading_items.feature +10 -0
- data/features/resolving_recipes.feature +26 -0
- data/features/searching_items.feature +83 -0
- data/features/searching_recipes.feature +42 -0
- data/features/step_definitions/item_manager_steps.rb +88 -0
- data/features/step_definitions/item_steps.rb +23 -0
- data/features/step_definitions/recipe_manager_steps.rb +42 -0
- data/features/support/env.rb +29 -0
- data/lib/crafting_table.rb +19 -0
- data/lib/crafting_table/item.rb +61 -0
- data/lib/crafting_table/item_manager.rb +171 -0
- data/lib/crafting_table/recipe.rb +36 -0
- data/lib/crafting_table/recipe_manager.rb +216 -0
- data/lib/crafting_table/search/damage_search.rb +51 -0
- data/lib/crafting_table/search/fuzzy_name_search.rb +39 -0
- data/lib/crafting_table/search/input_search.rb +47 -0
- data/lib/crafting_table/search/item_id_search.rb +51 -0
- data/lib/crafting_table/search/name_search.rb +71 -0
- data/lib/crafting_table/search/output_search.rb +47 -0
- data/lib/crafting_table/search/search_builder.rb +85 -0
- data/spec/crafting_table/item_manager_spec.rb +421 -0
- data/spec/crafting_table/item_spec.rb +67 -0
- data/spec/crafting_table/recipe_manager_spec.rb +353 -0
- data/spec/crafting_table/recipe_spec.rb +25 -0
- data/spec/crafting_table/search/search_builder.rb +105 -0
- data/spec/crafting_table/search/search_spec.rb +383 -0
- data/spec/spec_helper.rb +6 -0
- metadata +145 -0
- metadata.gz.asc +11 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module CraftingTable
|
6
|
+
|
7
|
+
describe Item do
|
8
|
+
|
9
|
+
describe '#initialize' do
|
10
|
+
|
11
|
+
it 'should have the damage value default to 0' do
|
12
|
+
expect(Item.new('Wood', 17).damage_value).to eq 0
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should set the appropriate instance variables' do
|
16
|
+
comp = Item.new('Wood', 17, 1)
|
17
|
+
expect(comp.name).to eq 'Wood'
|
18
|
+
expect(comp.item_id).to eq 17
|
19
|
+
expect(comp.damage_value).to eq 1
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#==' do
|
25
|
+
|
26
|
+
it 'should return true if name, item id and damage value are equal' do
|
27
|
+
expect(Item.new('Wood', 17)).to eq Item.new('Wood', 17)
|
28
|
+
expect(Item.new('Wood', 17, 2)).to eq Item.new('Wood', 17, 2)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should return false if name or item id are not equal' do
|
32
|
+
expect(Item.new('Wood', 17)).not_to eq Item.new('Wood', 16)
|
33
|
+
expect(Item.new('Wood', 17)).not_to eq Item.new('Log', 17)
|
34
|
+
expect(Item.new('Wood', 17, 1)).not_to eq Item.new('Wood', 17, 2)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe'#eql?' do
|
40
|
+
|
41
|
+
it 'should behave like #==' do
|
42
|
+
expect(Item.new('Wood', 17)).to eql Item.new('Wood', 17)
|
43
|
+
expect(Item.new('Wood', 17, 2)).to eql Item.new('Wood', 17, 2)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#hash' do
|
49
|
+
|
50
|
+
it 'should return a proper value' do
|
51
|
+
expect(Item.new('Wood', 17, 2).hash).to eq ['Wood', 17, 2].hash
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#identifier' do
|
57
|
+
|
58
|
+
it 'should return an array containing its id and damage value' do
|
59
|
+
expect(Item.new('Wood', 17, 2).identifier).to eq [17, 2]
|
60
|
+
expect(Item.new('Stone', 1, 0).identifier).to eq [1, 0]
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,353 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module CraftingTable
|
6
|
+
|
7
|
+
describe RecipeManager do
|
8
|
+
let(:item_log) { Item.new('Log', 17) }
|
9
|
+
|
10
|
+
let(:item_gold_ore) { Item.new('Gold Ore', 14) }
|
11
|
+
let(:item_iron_ore) { Item.new('Iron Ore', 15) }
|
12
|
+
|
13
|
+
let(:item_wood_oak) { Item.new('Oak Wood', 17, 0) }
|
14
|
+
let(:item_wood_spruce) { Item.new('Spruce Wood', 17, 1) }
|
15
|
+
let(:item_wood_birch) { Item.new('Birch Wood', 17, 2) }
|
16
|
+
let(:item_wood_jungle) { Item.new('Jungle Wood', 17, 3) }
|
17
|
+
|
18
|
+
let(:item_planks) { Item.new('Wood Planks', 5) }
|
19
|
+
let(:item_coal) { Item.new('Coal', 263) }
|
20
|
+
let(:item_stick) { Item.new('Stick', 280) }
|
21
|
+
let(:item_torch) { Item.new('Torch', 50) }
|
22
|
+
|
23
|
+
let(:item_manager) { ItemManager.new([item_log, item_planks, item_stick, item_coal, item_torch]) }
|
24
|
+
|
25
|
+
let(:recipe_planks) { Recipe.new('Wood Planks', { item_wood_oak => 1 }, { item_planks => 4 }) }
|
26
|
+
let(:recipe_sticks) { Recipe.new('Sticks', { item_planks => 2 }, { item_stick => 4 }) }
|
27
|
+
let(:recipe_torch) { Recipe.new('Torch', { item_stick => 1, item_coal => 1 }, { item_torch => 4 }) }
|
28
|
+
|
29
|
+
let(:manager) { RecipeManager.new(item_manager) }
|
30
|
+
|
31
|
+
|
32
|
+
describe '#initialize' do
|
33
|
+
|
34
|
+
it 'should set the appropriate instance variables' do
|
35
|
+
expect(manager.recipes).to eq []
|
36
|
+
expect(manager.item_manager).to eq item_manager
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#add' do
|
42
|
+
|
43
|
+
it 'should add the recipe to the internal collection' do
|
44
|
+
expect { manager.add(recipe_planks) }.to change { manager.recipes.count }.by 1
|
45
|
+
expect(manager.recipes).to include recipe_planks
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
describe '#add_from_file' do
|
51
|
+
|
52
|
+
it 'should add all recipes from the file' do
|
53
|
+
item_manager = ItemManager.new
|
54
|
+
item_manager.add_from_file(ITEM_FILE)
|
55
|
+
|
56
|
+
manager = RecipeManager.new(item_manager)
|
57
|
+
manager.add_from_file(RECIPE_FILE)
|
58
|
+
|
59
|
+
expect(manager).to have(4).recipes
|
60
|
+
recipe_names = manager.recipes.map(&:name).sort
|
61
|
+
expect(recipe_names).to eq ['Sticks', 'Stone', 'Torch', 'Oak Wood Planks'].sort
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#clear' do
|
67
|
+
|
68
|
+
it 'should remove all recipes from the internal collection' do
|
69
|
+
manager.add(recipe_torch)
|
70
|
+
expect { manager.clear }.to change { manager.recipes.count }.to 0
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#find' do
|
76
|
+
before(:each) do
|
77
|
+
manager.clear
|
78
|
+
manager.add(recipe_torch)
|
79
|
+
manager.add(recipe_planks)
|
80
|
+
manager.add(recipe_sticks)
|
81
|
+
end
|
82
|
+
|
83
|
+
context "when searching for the recipe's name" do
|
84
|
+
|
85
|
+
context 'with case sensitivity' do
|
86
|
+
|
87
|
+
it 'should return recipes with matching case' do
|
88
|
+
results = manager.find do |search|
|
89
|
+
search.case_sensitive = true
|
90
|
+
search.name = 'Torch'
|
91
|
+
end
|
92
|
+
expect(results).to eq [recipe_torch]
|
93
|
+
|
94
|
+
results = manager.find do |search|
|
95
|
+
search.case_sensitive = true
|
96
|
+
search.name = 'Sticks'
|
97
|
+
end
|
98
|
+
expect(results).to eq [recipe_sticks]
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should not return recipes where the case does not match' do
|
102
|
+
results = manager.find do |search|
|
103
|
+
search.case_sensitive = true
|
104
|
+
search.name = 'torch'
|
105
|
+
end
|
106
|
+
expect(results).to be_empty
|
107
|
+
|
108
|
+
results = manager.find do |search|
|
109
|
+
search.case_sensitive = true
|
110
|
+
search.name = 'stICkS'
|
111
|
+
end
|
112
|
+
expect(results).to be_empty
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'with case insensitivity' do
|
118
|
+
|
119
|
+
it 'should return recipes no matter their case' do
|
120
|
+
results = manager.find do |search|
|
121
|
+
search.case_sensitive = false
|
122
|
+
search.name = 'Torch'
|
123
|
+
end
|
124
|
+
expect(results).to eq [recipe_torch]
|
125
|
+
|
126
|
+
results = manager.find do |search|
|
127
|
+
search.case_sensitive = false
|
128
|
+
search.name = 'toRcH'
|
129
|
+
end
|
130
|
+
expect(results).to eq [recipe_torch]
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'with exact matching' do
|
136
|
+
|
137
|
+
it 'should return exact matches' do
|
138
|
+
results = manager.find do |search|
|
139
|
+
search.exact = true
|
140
|
+
search.name = 'Torch'
|
141
|
+
end
|
142
|
+
expect(results).to eq [recipe_torch]
|
143
|
+
|
144
|
+
results = manager.find do |search|
|
145
|
+
search.exact = true
|
146
|
+
search.name = 'Sticks'
|
147
|
+
end
|
148
|
+
expect(results).to eq [recipe_sticks]
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'should not return non-exact matches' do
|
152
|
+
results = manager.find do |search|
|
153
|
+
search.exact = true
|
154
|
+
search.name = 'Tor'
|
155
|
+
end
|
156
|
+
expect(results).to be_empty
|
157
|
+
|
158
|
+
results = manager.find do |search|
|
159
|
+
search.exact = true
|
160
|
+
search.name = 'ticks'
|
161
|
+
end
|
162
|
+
expect(results).to be_empty
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'with fuzzy matching' do
|
168
|
+
|
169
|
+
it 'should return non-exact matches too' do
|
170
|
+
results = manager.find do |search|
|
171
|
+
search.exact = false
|
172
|
+
search.name = 'Tor'
|
173
|
+
end
|
174
|
+
expect(results).to eq [recipe_torch]
|
175
|
+
|
176
|
+
results = manager.find do |search|
|
177
|
+
search.exact = false
|
178
|
+
search.name = 'ticks'
|
179
|
+
end
|
180
|
+
expect(results).to eq [recipe_sticks]
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'when searching for inputs' do
|
188
|
+
|
189
|
+
it 'should return all recipes which have the item as input' do
|
190
|
+
results = manager.find do |search|
|
191
|
+
search.input = item_coal
|
192
|
+
end
|
193
|
+
expect(results).to eq [recipe_torch]
|
194
|
+
|
195
|
+
results = manager.find do |search|
|
196
|
+
search.input = item_wood_oak
|
197
|
+
end
|
198
|
+
expect(results).to eq [recipe_planks]
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
context 'when searching for outputs' do
|
204
|
+
|
205
|
+
it 'should return all recipes which have the item as output' do
|
206
|
+
results = manager.find do |search|
|
207
|
+
search.output = item_torch
|
208
|
+
end
|
209
|
+
expect(results).to eq [recipe_torch]
|
210
|
+
|
211
|
+
results = manager.find do |search|
|
212
|
+
search.output = item_planks
|
213
|
+
end
|
214
|
+
expect(results).to eq [recipe_planks]
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
describe '#find_by_name' do
|
222
|
+
before(:each) do
|
223
|
+
manager.clear
|
224
|
+
manager.add(recipe_torch)
|
225
|
+
manager.add(recipe_planks)
|
226
|
+
manager.add(recipe_sticks)
|
227
|
+
end
|
228
|
+
|
229
|
+
context 'with case sensitivity' do
|
230
|
+
let(:args) { { case_sensitive: true } }
|
231
|
+
|
232
|
+
it 'should return recipes with matching case' do
|
233
|
+
expect(manager.find_by_name('Torch', args).first).to eq recipe_torch
|
234
|
+
expect(manager.find_by_name('Sticks', args).first).to eq recipe_sticks
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'should not return recipes where the case does not match' do
|
238
|
+
expect(manager.find_by_name('torch', args)).to be_empty
|
239
|
+
expect(manager.find_by_name('stICkS', args)).to be_empty
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
context 'with case-insensitivity' do
|
245
|
+
let(:args) { { case_sensitive: false } }
|
246
|
+
|
247
|
+
it 'should return recipes no matter their case' do
|
248
|
+
expect(manager.find_by_name('Torch', args).first).to eq recipe_torch
|
249
|
+
expect(manager.find_by_name('toRcH', args).first).to eq recipe_torch
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
context 'with exact matching' do
|
255
|
+
let(:args) { { exact: true } }
|
256
|
+
|
257
|
+
it 'should return exact matches' do
|
258
|
+
expect(manager.find_by_name('Torch', args).first).to eq recipe_torch
|
259
|
+
expect(manager.find_by_name('Sticks', args).first).to eq recipe_sticks
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'should not return non-exact matches' do
|
263
|
+
expect(manager.find_by_name('Tor', args)).to be_empty
|
264
|
+
expect(manager.find_by_name('ticks', args)).to be_empty
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
context 'with fuzzy matching' do
|
270
|
+
let(:args) { { exact: false } }
|
271
|
+
|
272
|
+
it 'should return non-exact matches too' do
|
273
|
+
expect(manager.find_by_name('Tor', args).first).to eq recipe_torch
|
274
|
+
expect(manager.find_by_name('ticks', args).first).to eq recipe_sticks
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
describe '#find_by_input' do
|
282
|
+
before(:each) do
|
283
|
+
manager.clear
|
284
|
+
manager.add(recipe_torch)
|
285
|
+
manager.add(recipe_planks)
|
286
|
+
manager.add(recipe_sticks)
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should return all recipes which have the item as input' do
|
290
|
+
expect(manager.find_by_input(item_coal).first).to eq recipe_torch
|
291
|
+
expect(manager.find_by_input(item_wood_oak).first).to eq recipe_planks
|
292
|
+
end
|
293
|
+
|
294
|
+
end
|
295
|
+
|
296
|
+
describe '#find_by_output' do
|
297
|
+
before(:each) do
|
298
|
+
manager.clear
|
299
|
+
manager.add(recipe_torch)
|
300
|
+
manager.add(recipe_planks)
|
301
|
+
manager.add(recipe_sticks)
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'should return all recipes which have the item as output' do
|
305
|
+
expect(manager.find_by_output(item_torch).first).to eq recipe_torch
|
306
|
+
expect(manager.find_by_output(item_planks).first).to eq recipe_planks
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
describe '#resolve_recipe' do
|
312
|
+
before(:each) do
|
313
|
+
manager.clear
|
314
|
+
manager.add(recipe_torch)
|
315
|
+
manager.add(recipe_planks)
|
316
|
+
manager.add(recipe_sticks)
|
317
|
+
end
|
318
|
+
|
319
|
+
context 'when resolving one torch' do
|
320
|
+
let(:result) { manager.resolve_recipe(recipe_torch, 1) }
|
321
|
+
|
322
|
+
it 'should return one wood and one coal' do
|
323
|
+
expect(result[item_coal]).to eq 1
|
324
|
+
expect(result[item_wood_oak]).to eq 1
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
|
329
|
+
context 'when resolving 32 torches' do
|
330
|
+
let(:result) { manager.resolve_recipe(recipe_torch, 32) }
|
331
|
+
|
332
|
+
it 'should return one wood and 8 coal' do
|
333
|
+
expect(result[item_coal]).to eq 8
|
334
|
+
expect(result[item_wood_oak]).to eq 1
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
|
339
|
+
context 'when resolving 100 torches' do
|
340
|
+
let(:result) { manager.resolve_recipe(recipe_torch, 100) }
|
341
|
+
|
342
|
+
it 'should return 4 wood and 25 coal' do
|
343
|
+
expect(result[item_coal]).to eq 25
|
344
|
+
expect(result[item_wood_oak]).to eq 4
|
345
|
+
end
|
346
|
+
|
347
|
+
end
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
352
|
+
|
353
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module CraftingTable
|
6
|
+
|
7
|
+
describe Recipe do
|
8
|
+
let(:comp_wood) { Item.new('Wood', 17, 0) }
|
9
|
+
let(:comp_planks) { Item.new('Wood Planks', 5, 0) }
|
10
|
+
|
11
|
+
let(:recipe_planks) { Recipe.new('Wood Planks', { comp_wood => 1 }, { comp_planks => 2 }) }
|
12
|
+
|
13
|
+
describe '#initialize' do
|
14
|
+
|
15
|
+
it 'should set the appropriate instance variables' do
|
16
|
+
expect(recipe_planks.name).to eq 'Wood Planks'
|
17
|
+
expect(recipe_planks.input).to eq({ comp_wood => 1 })
|
18
|
+
expect(recipe_planks.output).to eq({ comp_planks => 2})
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
|
5
|
+
module CraftingTable
|
6
|
+
|
7
|
+
module Search
|
8
|
+
|
9
|
+
describe SearchBuilder do
|
10
|
+
let(:search_for_name) do
|
11
|
+
search = SearchBuilder.new
|
12
|
+
search.name = 'Oak Wood'
|
13
|
+
search.case_sensitive = true
|
14
|
+
search.exact = true
|
15
|
+
search
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:search_for_name_fuzzy) do
|
19
|
+
search = SearchBuilder.new
|
20
|
+
search.name = 'Oak Wood'
|
21
|
+
search.case_sensitive = false
|
22
|
+
search.exact = false
|
23
|
+
search
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:search_for_item_id) do
|
27
|
+
search = SearchBuilder.new
|
28
|
+
search.item_id = 1
|
29
|
+
search
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:search_for_item_id_range) do
|
33
|
+
search = SearchBuilder.new
|
34
|
+
search.item_id = 5..10
|
35
|
+
search
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:search_for_damage_value) do
|
39
|
+
search = SearchBuilder.new
|
40
|
+
search.damage_value = [2, 4]
|
41
|
+
search
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:search_for_multiple_conditions) do
|
45
|
+
search = SearchBuilder.new
|
46
|
+
search.item_id = 1
|
47
|
+
search.name = 'Oak Wood'
|
48
|
+
search
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:search_for_input) do
|
52
|
+
search = SearchBuilder.new
|
53
|
+
search.input = Item.new('Stone', 1)
|
54
|
+
search
|
55
|
+
end
|
56
|
+
|
57
|
+
let(:search_for_output) do
|
58
|
+
search = SearchBuilder.new
|
59
|
+
search.output = Item.new('Torch', 50)
|
60
|
+
search
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#searches' do
|
64
|
+
|
65
|
+
it 'should return a NameSearch if name and exact were set' do
|
66
|
+
expect(search_for_name.searches).to eq [NameSearch.new('Oak Wood',
|
67
|
+
case_sensitive: true)]
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should return a FuzzyNameSearch if name was set, and exact was set to false' do
|
71
|
+
expect(search_for_name_fuzzy.searches).to eq [FuzzyNameSearch.new('Oak Wood',
|
72
|
+
case_sensitive: false)]
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should return a ItemIDSearch if item_id was set' do
|
76
|
+
expect(search_for_item_id.searches).to eq [ItemIDSearch.new(1)]
|
77
|
+
expect(search_for_item_id_range.searches).to eq [ItemIDSearch.new(5..10)]
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should return a DamageSearch if damage_value was set' do
|
81
|
+
expect(search_for_damage_value.searches).to eq [DamageSearch.new([2, 4])]
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should return an InputSearch if input was set' do
|
85
|
+
expect(search_for_input.searches).to eq [InputSearch.new(Item.new('Stone', 1))]
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should return an OutputSearch if output was set' do
|
89
|
+
expect(search_for_output.searches).to eq [OutputSearch.new(Item.new('Torch', 50))]
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should return multiple searches if multiple conditions were set' do
|
93
|
+
expect(search_for_multiple_conditions.searches).to eq [NameSearch.new('Oak Wood',
|
94
|
+
case_sensitive: true),
|
95
|
+
ItemIDSearch.new(1)]
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|