Sha256: 80c6875344c1f8b7a42e0d049a59c573eeb7231ebb24a4e0b6bd772c7fc72c4e
Contents?: true
Size: 953 Bytes
Versions: 2
Compression:
Stored size: 953 Bytes
Contents
require 'spec_helper' include Huff describe EncodingTableBuilder do it 'creates a encoding table from a encoding tree' do enconding_tree = ['c', ['b', 'a']] subject = EncodingTableBuilder.new(enconding_tree) expect(subject.table).to eq({'c' => '0', 'b' => '10', 'a' => '11'}) end it 'creates a encoding table from a more comples encoding tree' do enconding_tree = [['i', 's'], [['r', 'p'], [['e', ' '], ['m', 'v']]]] subject = EncodingTableBuilder.new(enconding_tree) expect(subject.table).to eq({'i' => '00', 's' => '01', 'r' => '100', 'p' => '101', 'e' => '1100', ' ' => '1101', 'm' => '1110', 'v' => '1111'}) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
huff-0.0.2 | spec/lib/huff/encoding_table_builder_spec.rb |
huff-0.0.1 | spec/lib/huff/encoding_table_builder_spec.rb |