Sha256: cea8e310dc8a202fb9aef40cd9c101c9eb9b191f1a2fcecf093ed3cd251a768f
Contents?: true
Size: 672 Bytes
Versions: 1
Compression:
Stored size: 672 Bytes
Contents
require 'spec_helper' include Huff describe Encoder do it 'encode a string' do encoding_tree = ['c', ['b', 'a']] subject = Encoder.new(encoding_tree) expect(subject.encode_string('abc')).to eq '11100' expect(subject.encode_36('abc')).to eq 's' end it 'encode a more complex string' do encoding_tree = [['i', 's'], [['r', 'p'], [['e', ' '], ['m', 'v']]]] subject = Encoder.new(encoding_tree) expect(subject.encode_string('mississipi river')).to eq '1110000101000101001010011011000011111100100' expect(subject.encode_36('mississipi river')).to eq '2qrt5j4ro' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
huff-0.0.2 | spec/lib/huff/encoder_spec.rb |