Sha256: a24561aee2769d133834572bc3c14b1befeadee7e3695f4933a6dd074a1c1196
Contents?: true
Size: 700 Bytes
Versions: 24
Compression:
Stored size: 700 Bytes
Contents
require 'spec_helper' describe Internals::Generators::Weights::Logarithmic do before(:each) do @cacher = described_class.new end describe 'generate_from' do it 'should not fail on empties' do @cacher.generate_from({ :key => [] }).should == { :key => 0 } end it 'should round to 2' do @cacher.generate_from({ :key => [1,2,3,4] }).should == { :key => 1.39 } end end describe 'weight_for' do it 'should be 0 for 0' do @cacher.weight_for(0).should == 0 end it 'should be 0 for 1' do @cacher.weight_for(1).should == 0 end it 'should be log(x) for x' do @cacher.weight_for(1234).should == Math.log(1234) end end end
Version data entries
24 entries across 24 versions & 1 rubygems