Sha256: ced95f894597fa604d650690c45a22ee3503d808592bea8e2ae1d7d3e068875e
Contents?: true
Size: 717 Bytes
Versions: 7
Compression:
Stored size: 717 Bytes
Contents
require 'spec_helper' describe Rambling::Trie::Compressor do let(:compressor) { Rambling::Trie::Compressor.new } describe '#compress' do let(:words) { %w(a few words hello hell) } let(:root) do Rambling::Trie::RawNode.new end before do words.each { |w| root.add w.clone } end it 'generates a new root with the words from the passed root' do new_root = compressor.compress root expect(words).not_to be_empty words.each do |word| expect(new_root).to include word end end it 'compresses the new root' do new_root = compressor.compress root expect(new_root.children_tree.keys).to eq %i(a few words hell) end end end
Version data entries
7 entries across 7 versions & 1 rubygems