Sha256: 782abcc278a4c9c3d403ee40a46e92855410b4d24c8138f89fb34eb06a887d0c
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.1 | spec/lib/huff/encoder_spec.rb |