meiro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,153 @@
1
+ require 'spec_helper'
2
+
3
+ describe Meiro::Dungeon do
4
+ let(:options) do
5
+ {
6
+ width: width,
7
+ height: height,
8
+ min_room_number: min_room_number,
9
+ max_room_number: max_room_number,
10
+ min_room_width: min_room_width,
11
+ min_room_height: min_room_height,
12
+ max_room_width: max_room_width,
13
+ max_room_height: max_room_height,
14
+ block_split_factor: block_split_factor,
15
+ }
16
+ end
17
+ # デフォルト値
18
+ let(:width) { 60 }
19
+ let(:height) { 40 }
20
+ let(:min_room_number) { 1 }
21
+ let(:max_room_number) { 6 }
22
+ let(:min_room_width) { 8 }
23
+ let(:min_room_height) { 6 }
24
+ let(:max_room_width) { 20 }
25
+ let(:max_room_height) { 20 }
26
+ let(:block_split_factor) { 1.0 }
27
+
28
+ describe '.new' do
29
+ subject { described_class.new(options) }
30
+
31
+ shared_examples '.new' do
32
+ its(:class) { should eq(described_class) }
33
+ its(:width) { should eq(width) }
34
+ its(:height) { should eq(height) }
35
+ its(:min_room_number) { should eq(min_room_number) }
36
+ its(:max_room_number) { should eq(max_room_number) }
37
+ its(:min_room_width) { should eq(min_room_width) }
38
+ its(:min_room_height) { should eq(min_room_height) }
39
+ its(:max_room_width) { should eq(max_room_width) }
40
+ its(:max_room_height) { should eq(max_room_height) }
41
+ its(:block_split_factor) { should eq(block_split_factor) }
42
+ end
43
+
44
+ context 'オプション指定なしの場合(デフォルト値)' do
45
+ let(:options) { Hash.new }
46
+
47
+ include_examples '.new'
48
+ end
49
+
50
+ context 'オプション指定ありの場合' do
51
+ let(:width) { 10 }
52
+ let(:height) { 10 }
53
+ let(:min_room_number) { 2 }
54
+ let(:max_room_number) { 5 }
55
+ let(:min_room_width) { 10 }
56
+ let(:min_room_height) { 10 }
57
+ let(:max_room_width) { 30 }
58
+ let(:max_room_height) { 30 }
59
+ let(:block_split_factor) { 0.5 }
60
+
61
+ include_examples '.new'
62
+ end
63
+
64
+ [
65
+ [:width, '60'],
66
+ [:height, '40'],
67
+ [:min_room_number, '1'],
68
+ [:max_room_number, '6'],
69
+ [:min_room_width, '8'],
70
+ [:min_room_height, '6'],
71
+ [:max_room_width, '20'],
72
+ [:max_room_height, '20'],
73
+ [:block_split_factor, 1],
74
+ ].each do |key, value|
75
+ context "#{key}に不正なクラス(#{value.class})のオプションを指定した場合" do
76
+ let(:options) { {key => value} }
77
+
78
+ it { expect { subject }.to raise_error }
79
+ end
80
+ end
81
+
82
+ [
83
+ [:width, 4],
84
+ [:height, 4],
85
+ [:min_room_number, 0],
86
+ [:min_room_width, 2],
87
+ [:min_room_height, 2],
88
+ [:block_split_factor, 0.0],
89
+ ].each do |key, value|
90
+ context "#{key}に下限以下の値(#{value})を指定したの場合" do
91
+ let(:options) { {key => value} }
92
+
93
+ it { expect { subject }.to raise_error }
94
+ end
95
+ end
96
+
97
+ context "max_room_numberにmin_room_number以下の値を指定したの場合" do
98
+ let(:min_room_number) { 5 }
99
+ let(:max_room_number) { 4 }
100
+
101
+ it { expect { subject }.to raise_error }
102
+ end
103
+
104
+ context "max_room_widthにmin_room_width以下の値を指定したの場合" do
105
+ let(:min_room_width) { 20 }
106
+ let(:max_room_width) { 15 }
107
+
108
+ it { expect { subject }.to raise_error }
109
+ end
110
+
111
+ context "max_room_heightにmin_room_height以下の値を指定したの場合" do
112
+ let(:min_room_height) { 20 }
113
+ let(:max_room_height) { 15 }
114
+
115
+ it { expect { subject }.to raise_error }
116
+ end
117
+ end
118
+
119
+ describe '#create_floor' do
120
+ before do
121
+ args = [dungeon, width, height,
122
+ min_room_width, min_room_height,
123
+ max_room_width, max_room_height]
124
+ Meiro::Floor.should_receive(:new).once.with(*args)
125
+ end
126
+
127
+ let(:dungeon) { described_class.new(options) }
128
+
129
+ subject { dungeon.create_floor }
130
+
131
+ it 'Meiro::Floor.newをcallする' do
132
+ expect { subject }.not_to raise_error
133
+ end
134
+ end
135
+
136
+ describe '#generate_random_floor' do
137
+ before do
138
+ randomizer = dungeon.instance_variable_get(:@randomizer)
139
+ args = [min_room_number, max_room_number,
140
+ block_split_factor, randomizer]
141
+ Meiro::Floor.any_instance.
142
+ should_receive(:generate_random_room).once.with(*args)
143
+ end
144
+
145
+ let(:dungeon) { described_class.new(options) }
146
+
147
+ subject { dungeon.generate_random_floor }
148
+
149
+ it 'Meiro::Floorのインスタンスに対しgenerate_random_roomをcallする' do
150
+ expect { subject }.not_to raise_error
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,526 @@
1
+ require 'spec_helper'
2
+
3
+ class Meiro::Floor
4
+ # テスト用にアクセス可能にする
5
+ attr_accessor :min_room_width, :min_room_height,
6
+ :max_room_width, :max_room_height,
7
+ :root_block, :base_map
8
+
9
+ # テスト用にpublic実行可能にする
10
+ public :do_separate?
11
+ end
12
+
13
+ describe Meiro::Floor do
14
+ # デフォルト値
15
+ let(:width) { 60 }
16
+ let(:height) { 40 }
17
+ let(:min_room_number) { 1 }
18
+ let(:max_room_number) { 6 }
19
+ let(:min_room_width) { 8 }
20
+ let(:min_room_height) { 6 }
21
+ let(:max_room_width) { 20 }
22
+ let(:max_room_height) { 20 }
23
+ let(:block_split_factor) { 1.0 }
24
+ let(:options) do
25
+ {
26
+ width: width,
27
+ height: height,
28
+ min_room_number: min_room_number,
29
+ max_room_number: max_room_number,
30
+ min_room_width: min_room_width,
31
+ min_room_height: min_room_height,
32
+ max_room_width: max_room_width,
33
+ max_room_height: max_room_height,
34
+ block_split_factor: block_split_factor,
35
+ }
36
+ end
37
+ let(:dungeon) { Meiro::Dungeon.new(options) }
38
+
39
+ describe '.new' do
40
+ subject do
41
+ described_class.new(dungeon, width, height,
42
+ min_room_width, min_room_height,
43
+ max_room_width, max_room_height)
44
+ end
45
+
46
+ context 'デフォルト値' do
47
+ its(:dungeon) { should eq(dungeon) }
48
+ its(:min_room_width) { should eq(min_room_width) }
49
+ its(:min_room_height) { should eq(min_room_height) }
50
+ its(:max_room_width) { should eq(max_room_width) }
51
+ its(:max_room_height) { should eq(max_room_height) }
52
+ its(:root_block) { should_not be_nil }
53
+ its(:base_map) { should_not be_nil }
54
+ end
55
+
56
+ context '幅が下限を下回る場合' do
57
+ let(:width) { 4 }
58
+
59
+ it { expect{ subject }.to raise_error }
60
+ end
61
+
62
+ context '高さが下限を下回る場合' do
63
+ let(:height) { 4 }
64
+
65
+ it { expect{ subject }.to raise_error }
66
+ end
67
+ end
68
+
69
+ let(:floor) do
70
+ described_class.new(dungeon, width, height,
71
+ min_room_width, min_room_height,
72
+ max_room_width, max_room_height)
73
+ end
74
+
75
+ describe '#width' do
76
+ subject { floor.width }
77
+
78
+ context 'デフォルト値' do
79
+ it { should eq(60) }
80
+ end
81
+ end
82
+
83
+ describe '#height' do
84
+ subject { floor.height }
85
+
86
+ context 'デフォルト値' do
87
+ it { should eq(40) }
88
+ end
89
+ end
90
+
91
+ describe '#all_blocks' do
92
+ before(:each) do
93
+ floor.root_block.should_receive(:flatten).once
94
+ end
95
+
96
+ subject { floor.all_blocks }
97
+
98
+ it { expect { subject }.not_to raise_error }
99
+ end
100
+
101
+ describe '#all_rooms' do
102
+ let(:room) { Meiro::Room.new(3, 3) }
103
+
104
+ subject { floor.all_rooms }
105
+
106
+ context 'rootのみ' do
107
+ context '部屋なしの場合' do
108
+ it { should eq([]) }
109
+ end
110
+
111
+ context '部屋ありの場合' do
112
+ before { floor.root_block.put_room(room) }
113
+
114
+ it { should eq([room]) }
115
+ end
116
+ end
117
+
118
+ context 'root分割済み' do
119
+ before(:each) { floor.root_block.separate }
120
+
121
+ context '部屋なしの場合' do
122
+ it { should eq([]) }
123
+ end
124
+
125
+ context '部屋1個の場合' do
126
+ before { floor.root_block.upper_left.put_room(room) }
127
+
128
+ it { should eq([room]) }
129
+ end
130
+
131
+ context '部屋2個の場合' do
132
+ let(:another_room) { Meiro::Room.new(3, 3) }
133
+
134
+ before do
135
+ floor.root_block.upper_left.put_room(room)
136
+ floor.root_block.lower_right.put_room(another_room)
137
+ end
138
+
139
+ it { should eq([room, another_room]) }
140
+ end
141
+ end
142
+ end
143
+
144
+ describe '#all_room_tiles_xy' do
145
+ let(:room) { Meiro::Room.new(3, 3) }
146
+
147
+ subject { floor.all_room_tiles_xy }
148
+
149
+ context 'rootのみ' do
150
+ context '部屋なしの場合' do
151
+ it { should eq([]) }
152
+ end
153
+
154
+ context '部屋あり' do
155
+ before do
156
+ floor.root_block.put_room(room)
157
+ room.relative_x = room_relative_x
158
+ room.relative_y = room_relative_y
159
+ end
160
+
161
+ context '相対座標(1,2)の場合' do
162
+ let(:room_relative_x) { 1 }
163
+ let(:room_relative_y) { 2 }
164
+ let(:expected_ary) do
165
+ a = []
166
+ (2..4).each{|y| (1..3).each{|x| a << [x, y] } }
167
+ a
168
+ end
169
+
170
+ it { should eq(expected_ary) }
171
+ end
172
+ end
173
+ end
174
+
175
+ context 'root分割済み' do
176
+ before(:each) { floor.root_block.separate }
177
+
178
+ context '部屋なしの場合' do
179
+ it { should eq([]) }
180
+ end
181
+
182
+ context '部屋1個' do
183
+ before do
184
+ floor.root_block.upper_left.put_room(room)
185
+ room.relative_x = room_relative_x
186
+ room.relative_y = room_relative_y
187
+ end
188
+
189
+ context '相対座標(1,2)の場合' do
190
+ let(:room_relative_x) { 1 }
191
+ let(:room_relative_y) { 2 }
192
+ let(:expected_ary) do
193
+ a = []
194
+ cx = floor.root_block.upper_left.x
195
+ cy = floor.root_block.upper_left.y
196
+ ((cy+2)..(cy+4)).each{|y| ((cx+1)..(cx+3)).each{|x| a << [x, y] } }
197
+ a
198
+ end
199
+
200
+ it { should eq(expected_ary) }
201
+ end
202
+ end
203
+
204
+ context '部屋2個' do
205
+ let(:another_room) { Meiro::Room.new(3, 3) }
206
+
207
+ before do
208
+ floor.root_block.upper_left.put_room(room)
209
+ room.relative_x = room_relative_x
210
+ room.relative_y = room_relative_y
211
+ floor.root_block.lower_right.put_room(another_room)
212
+ another_room.relative_x = room_relative_x
213
+ another_room.relative_y = room_relative_y
214
+ end
215
+
216
+ context '相対座標(1,2)の場合' do
217
+ let(:room_relative_x) { 1 }
218
+ let(:room_relative_y) { 2 }
219
+ let(:expected_ary) do
220
+ a = []
221
+ cx = floor.root_block.upper_left.x
222
+ cy = floor.root_block.upper_left.y
223
+ ((cy+2)..(cy+4)).each{|y| ((cx+1)..(cx+3)).each{|x| a << [x, y] } }
224
+ cx = floor.root_block.lower_right.x
225
+ cy = floor.root_block.lower_right.y
226
+ ((cy+2)..(cy+4)).each{|y| ((cx+1)..(cx+3)).each{|x| a << [x, y] } }
227
+ a
228
+ end
229
+
230
+ it { should eq(expected_ary) }
231
+ end
232
+ end
233
+ end
234
+ end
235
+
236
+ describe '#get_block' do
237
+
238
+ subject { floor.get_block(x, y) }
239
+
240
+ context 'rootのみ' do
241
+ [
242
+ [0, 0],
243
+ [1, 1],
244
+ [0, 39], # height-1
245
+ [0, 40], # height
246
+ [59, 0], # width-1
247
+ [60, 0], # width
248
+ [59, 39], # width-1, height-1
249
+ [60, 40], # width, height
250
+ ].each do |_x, _y|
251
+ context "座標(#{_x}, #{_y})を指定した場合" do
252
+ let(:x) { _x }
253
+ let(:y) { _y }
254
+ it { should eq(floor.root_block) }
255
+ end
256
+ end
257
+ end
258
+
259
+ context 'root1回分割済み' do
260
+ [
261
+ [ 0, 0, :upper_left],
262
+ [ 1, 1, :upper_left],
263
+ [ 0, 39, :upper_left], # height-1
264
+ [ 0, 40, :upper_left], # height
265
+ [59, 0, :lower_right], # width-1
266
+ [60, 0, :lower_right], # width
267
+ [59, 39, :lower_right], # width-1, height-1
268
+ [60, 40, :lower_right], # width, height
269
+ ].each do |_x, _y, which|
270
+ context "座標(#{_x}, #{_y})を指定した場合" do
271
+ before(:each) { floor.root_block.separate }
272
+ let(:x) { _x }
273
+ let(:y) { _y }
274
+ it "#{which}を返す" do
275
+ should eq(floor.root_block.send(which))
276
+ end
277
+ end
278
+ end
279
+ end
280
+
281
+ context 'root2回分割済み' do
282
+ [
283
+ [ 0, 0, :upper_left, :upper_left],
284
+ [ 1, 1, :upper_left, :upper_left],
285
+ [ 0, 39, :upper_left, :lower_right], # height-1
286
+ [ 0, 40, :upper_left, :lower_right], # height
287
+ [59, 0, :lower_right, :upper_left], # width-1
288
+ [60, 0, :lower_right, :upper_left], # width
289
+ [59, 39, :lower_right, :lower_right], # width-1, height-1
290
+ [60, 40, :lower_right, :lower_right], # width, height
291
+ ].each do |_x, _y, which_1, which_2|
292
+ context "座標(#{_x}, #{_y})を指定した場合" do
293
+ before(:each) do
294
+ floor.root_block.separate
295
+ floor.root_block.upper_left.separate
296
+ floor.root_block.lower_right.separate
297
+ end
298
+ let(:x) { _x }
299
+ let(:y) { _y }
300
+ it "#{which_1}の#{which_2}を返す" do
301
+ should eq(floor.root_block.send(which_1).send(which_2))
302
+ end
303
+ end
304
+ end
305
+ end
306
+ end
307
+
308
+ describe '#fill_floor_by_wall' do
309
+ before(:each) { floor.fill_floor_by_wall(width, height) }
310
+
311
+ subject { floor.base_map }
312
+
313
+ context 'デフォルト値' do
314
+ its(:width) { should eq(60) }
315
+ its(:height) { should eq(40) }
316
+ it do
317
+ subject.each_tile do |x, y, tile|
318
+ tile.should be_instance_of(Meiro::Tile::Wall)
319
+ end
320
+ end
321
+ end
322
+ end
323
+
324
+ # 1 を seed にすると rand が
325
+ # 5, 8, 9, 5, 0, 0, 1, 7, 6, 9...
326
+ # の順に返す
327
+ let(:randomizer) { Random.new(1) }
328
+
329
+ describe '#generate_random_room' do
330
+ # TODO
331
+ end
332
+
333
+ describe '#connect_rooms' do
334
+ subject { floor.connect_rooms(randomizer) }
335
+
336
+ context '部屋なしの場合' do
337
+ before { Meiro::Room.any_instance.should_not_receive(:create_passage) }
338
+
339
+ it { expect{ subject }.not_to raise_error }
340
+ end
341
+
342
+ context 'rootブロックに部屋1個の場合' do
343
+ let(:room) { Meiro::Room.new(3, 3) }
344
+
345
+ before do
346
+ floor.root_block.put_room(room)
347
+ room.should_receive(:create_passage).once.with(randomizer)
348
+ end
349
+
350
+ it { expect{ subject }.not_to raise_error }
351
+ end
352
+
353
+ context '部屋2個の場合' do
354
+ let(:room1) { Meiro::Room.new(3, 3) }
355
+ let(:room2) { Meiro::Room.new(3, 3) }
356
+
357
+ before do
358
+ floor.root_block.separate
359
+ floor.root_block.upper_left.put_room(room1)
360
+ floor.root_block.lower_right.put_room(room2)
361
+ room1.should_receive(:create_passage).once.with(randomizer)
362
+ room2.should_receive(:create_passage).once.with(randomizer)
363
+ end
364
+
365
+ it { expect{ subject }.not_to raise_error }
366
+ end
367
+ end
368
+
369
+ describe '#apply_rooms_to_map' do
370
+ subject { floor.apply_rooms_to_map }
371
+
372
+ context '部屋なしの場合' do
373
+ before do
374
+ floor.base_map.should_not_receive(:apply_room)
375
+ Meiro::Room.any_instance.should_not_receive(:apply_passage)
376
+ end
377
+
378
+ it { expect{ subject }.not_to raise_error }
379
+ end
380
+
381
+ context '部屋2個の場合' do
382
+ let(:room1) { Meiro::Room.new(3, 3) }
383
+ let(:room2) { Meiro::Room.new(3, 3) }
384
+ let(:flat_klass) { Meiro::Tile::Flat }
385
+ let(:pass_klass) { Meiro::Tile::Passage }
386
+ let(:gate_klass) { Meiro::Tile::Gate }
387
+
388
+ before do
389
+ floor.root_block.separate
390
+ floor.root_block.upper_left.put_room(room1)
391
+ floor.root_block.lower_right.put_room(room2)
392
+ map = floor.base_map
393
+ map.should_receive(:apply_room).with(room1, flat_klass).once
394
+ map.should_receive(:apply_room).with(room2, flat_klass).once
395
+ map.should_receive(:apply_passage).
396
+ with([room1, room2], gate_klass, pass_klass).once
397
+ end
398
+
399
+ it { expect{ subject }.not_to raise_error }
400
+ end
401
+ end
402
+
403
+ describe '#separate_blocks' do
404
+ subject do
405
+ floor.separate_blocks(min_room_number, max_room_number,
406
+ block_split_factor, randomizer)
407
+ end
408
+
409
+ context 'Room数下限:1,上限:6でsplit_factorが1.0の場合' do
410
+ # 第1世代(root): (1 / 1.0 < 5) => true
411
+ # => 分割後、合計2個
412
+ # 第2世代_1: (2 / 1.0 < 8) => true
413
+ # 第2世代_2: (2 / 1.0 < 9) => true
414
+ # => 分割後、合計4個
415
+ # 第3世代_1: (3 / 1.0 < 5) => true
416
+ # 第3世代_2: (3 / 1.0 < 0) => false
417
+ # 第3世代_3: (3 / 1.0 < 0) => false
418
+ # 第3世代_4: (3 / 1.0 < 1) => false
419
+ # => 分割後、合計5個
420
+ its('root_block.flatten.size') { should eq(5) }
421
+ end
422
+
423
+ context 'Room数下限:1,上限:1でsplit_factorが1.0の場合' do
424
+ let(:max_room_number) { 1 }
425
+ # 第1世代(root)-try1: (1 / 1.0 < 5) => true
426
+ # => 分割後2個になり、失敗判定でやり直し
427
+ # 第1世代(root)-try2: (1 / 1.0 < 8) => true
428
+ # => 分割後2個になり、失敗判定でやり直し
429
+ # 第1世代(root)-try3: (1 / 1.0 < 9) => true
430
+ # => 分割後2個になり、失敗判定でやり直し
431
+ # 第1世代(root)-try4: (1 / 1.0 < 5) => true
432
+ # => 分割後2個になり、失敗判定でやり直し
433
+ # 第1世代(root)-try5: (1 / 1.0 < 0) => false
434
+ # => 分割せず条件を満たして終了
435
+ its('root_block.flatten.size') { should eq(1) }
436
+ end
437
+
438
+ context 'Room数下限:2,上限:2でsplit_factorが1.0の場合' do
439
+ let(:min_room_number) { 2 }
440
+ let(:max_room_number) { 2 }
441
+ its('root_block.flatten.size') { should eq(2) }
442
+ end
443
+
444
+ context 'Room数下限:3,上限:3でsplit_factorが1.0の場合' do
445
+ let(:min_room_number) { 3 }
446
+ let(:max_room_number) { 3 }
447
+ its('root_block.flatten.size') { should eq(3) }
448
+ end
449
+
450
+ context 'Room数下限:4,上限:4でsplit_factorが1.0の場合' do
451
+ let(:min_room_number) { 4 }
452
+ let(:max_room_number) { 4 }
453
+ its('root_block.flatten.size') { should eq(4) }
454
+ end
455
+
456
+ context '不可能な条件を指定した場合' do
457
+ let(:min_room_number) { 100 }
458
+ let(:max_room_number) { 100 }
459
+
460
+ it { expect { subject }.to raise_error(Meiro::TrySeparateLimitError) }
461
+ end
462
+ end
463
+
464
+ describe '#do_separate?' do
465
+ let(:randomizer) { Random.new(1) }
466
+ let(:block) { floor.root_block }
467
+
468
+ subject { floor.do_separate?(block, block_split_factor, randomizer) }
469
+
470
+ context 'rootの分割判定' do
471
+ context 'split_factorが1.0、乱数が5を返す場合' do
472
+ # block.generation が 1,
473
+ # block_split_factor が 1.0,
474
+ # 乱数が 5 を必ず返すため、 1 / 1.0 < 5 で true
475
+ it { should be_true }
476
+ end
477
+
478
+ context 'split_factorが0.1、乱数が5を返す場合' do
479
+ let(:block_split_factor) { 0.1 }
480
+ # block.generation が 1,
481
+ # block_split_factor が 0.1,
482
+ # 乱数が 5 を必ず返すため、 1 / 0.1 > 5 で false
483
+ it { should be_false }
484
+ end
485
+
486
+ context 'split_factorが10.0、乱数が5を返す場合' do
487
+ let(:block_split_factor) { 10.0 }
488
+ # block.generation が 1,
489
+ # block_split_factor が 10.0,
490
+ # 乱数が 5 を必ず返すため、 1 / 10 < 5 で true
491
+ it { should be_true }
492
+ end
493
+ end
494
+
495
+ context '5世代目のBlockの分割判定' do
496
+ let(:first) { Meiro::Block.new(floor, 0, 0, width, height, nil) }
497
+ let(:second) { Meiro::Block.new(floor, 0, 0, width, height, first) }
498
+ let(:third) { Meiro::Block.new(floor, 0, 0, width, height, second) }
499
+ let(:fourth) { Meiro::Block.new(floor, 0, 0, width, height, third) }
500
+ let(:block) { Meiro::Block.new(floor, 0, 0, width, height, fourth) }
501
+
502
+ context 'split_factorが1.0、乱数が5を返す場合' do
503
+ # block.generation が 5,
504
+ # block_split_factor が 1.0,
505
+ # 乱数が 5 を必ず返すため、 5 / 1.0 == 5 で false
506
+ it { should be_false }
507
+ end
508
+
509
+ context 'split_factorが0.1、乱数が5を返す場合' do
510
+ let(:block_split_factor) { 0.1 }
511
+ # block.generation が 5,
512
+ # block_split_factor が 0.1,
513
+ # 乱数が 5 を必ず返すため、 5 / 0.1 > 5 で false
514
+ it { should be_false }
515
+ end
516
+
517
+ context 'split_factorが10.0、乱数が5を返す場合' do
518
+ let(:block_split_factor) { 10.0 }
519
+ # block.generation が 5,
520
+ # block_split_factor が 10.0,
521
+ # 乱数が 5 を必ず返すため、 5 / 10 < 5 で true
522
+ it { should be_true }
523
+ end
524
+ end
525
+ end
526
+ end