Skip to content

Commit 76a4511

Browse files
committed
spec for densities
1 parent 1234c42 commit 76a4511

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/document/text_block_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ module Boilerpipe
8989
block.merge_next(another_block)
9090
expect(block.offset_blocks_end).to eq 5
9191
end
92+
93+
it 'recomputes densities' do
94+
block = Document::TextBlock.new('one', 10, 5, 10, 2, 5)
95+
another_block = Document::TextBlock.new('two', 10, 5, 10, 3, 3)
96+
97+
block.merge_next(another_block)
98+
99+
expect(block.text_density).to eq 4.0
100+
expect(block.link_density).to eq 0.5
101+
end
92102
end
93103

94104
describe '#add_label' do

0 commit comments

Comments
 (0)