Sha256: 9bbb66145117256042f0610d6507174220f691d7340daa46d85f0cf9c226a00d

Contents?: true

Size: 574 Bytes

Versions: 11

Compression:

Stored size: 574 Bytes

Contents

require 'spec_helper'

describe WBench::TimingHash do
  describe '#new' do
    let(:timings) { { :end => 20, :middle => 15, :start => 10, :nope => 0 } }
    subject { described_class.new(timings) }

    it 'removes keys with a value of 0' do
      subject.should_not have_key :nope
    end

    it 'offsets each value by the starting(lowest) value' do
      subject[:start].should == 0
      subject[:middle].should == 5
      subject[:end].should == 10
    end

    it 'orders the hash by value, lowest first' do
      subject.first.should == [:start, 0]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wbench-0.3.7 spec/wbench/timing_hash_spec.rb
wbench-0.3.6 spec/wbench/timing_hash_spec.rb
wbench-0.3.5 spec/wbench/timing_hash_spec.rb
wbench-0.3.4 spec/wbench/timing_hash_spec.rb
wbench-0.3.3 spec/wbench/timing_hash_spec.rb
wbench-0.3.2 spec/wbench/timing_hash_spec.rb
wbench-0.3.1 spec/wbench/timing_hash_spec.rb
wbench-0.3.0 spec/wbench/timing_hash_spec.rb
wbench-0.2.3 spec/wbench/timing_hash_spec.rb
wbench-0.2.2 spec/wbench/timing_hash_spec.rb
wbench-0.2.1 spec/wbench/timing_hash_spec.rb