Sha256: a7dfb0ef8a071bbf45577963ea3d8a2ec63e8e55df286c7d2e6b7f2a3c4ff776

Contents?: true

Size: 1.26 KB

Versions: 19

Compression:

Stored size: 1.26 KB

Contents

require 'sqed_utils'

describe SqedUtils do

  context '.corrected_frequency' do

    specify '[1,2,3]' do
      expect(SqedUtils.corrected_frequency([1,2,3])).to eq([1,2,3] )
    end

    specify '[1,2,3], max_width: 100' do
      expect(SqedUtils.corrected_frequency([1,2,3], max_width: 100)).to eq([1,2,3] )
    end

    specify '[90,100,1000], max_width: 2000' do
      expect(SqedUtils.corrected_frequency([90,100,1000], max_width: 2000)).to eq([90, 100, 105] )
    end

    specify '[90,100,1000], max_width: 2000)' do
      expect(SqedUtils.corrected_frequency([90,100,1000], max_width: 2000)).to eq([90, 100, 105] )
    end

    specify '[90,1000,1010], max_width: 2000)' do
      expect(SqedUtils.corrected_frequency([90,1000,1010], max_width: 2000)).to eq([995, 1000, 1010] )
    end

    specify '[10, 12, 20], max_width: 2000' do
      expect(SqedUtils.corrected_frequency([10, 12, 20], max_width: 2000)).to eq([10, 12, 20] )
    end

   specify '[10, 12, 20], max_width: 100)' do
      expect(SqedUtils.corrected_frequency([10, 12, 20], max_width: 100)).to eq([10, 12, 13] )
    end

   specify '[10, 12, 20], max_width: 100, width_factor: 5)' do
     expect(SqedUtils.corrected_frequency([1, 3, 10], max_width: 100, width_factor: 5)).to eq([0, 3, 4] )
   end


  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sqed-0.8.3 spec/lib/sqed_utils_spec.rb
sqed-0.8.2 spec/lib/sqed_utils_spec.rb
sqed-0.8.1 spec/lib/sqed_utils_spec.rb
sqed-0.8.0 spec/lib/sqed_utils_spec.rb
sqed-0.7.1 spec/lib/sqed_utils_spec.rb
sqed-0.7.0 spec/lib/sqed_utils_spec.rb
sqed-0.6.0 spec/lib/sqed_utils_spec.rb
sqed-0.5.8 spec/lib/sqed_utils_spec.rb
sqed-0.5.7 spec/lib/sqed_utils_spec.rb
sqed-0.5.6 spec/lib/sqed_utils_spec.rb
sqed-0.5.5 spec/lib/sqed_utils_spec.rb
sqed-0.5.4 spec/lib/sqed_utils_spec.rb
sqed-0.5.3 spec/lib/sqed_utils_spec.rb
sqed-0.5.2 spec/lib/sqed_utils_spec.rb
sqed-0.5.1 spec/lib/sqed_utils_spec.rb
sqed-0.5.0 spec/lib/sqed_utils_spec.rb
sqed-0.4.4 spec/lib/sqed_utils_spec.rb
sqed-0.4.3 spec/lib/sqed_utils_spec.rb
sqed-0.4.2 spec/lib/sqed_utils_spec.rb