Sha256: d103c5ffe51ca4cc4a3b9e5dc8d07cad67d4becbad98f783e5ab6a736b465d23
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
describe WBench::Stats do describe '#median' do context 'when there are an odd number of results' do subject(:stats) { described_class.new([1,6,2,8,3]) } it 'returns the middle result' do expect(stats.median).to eq(3) end end context 'when there an an event number of results' do subject(:stats) { described_class.new([1,6,2,8,3,9]) } it 'returns the higher of the two middle values' do expect(stats.median).to eq(6) end end end describe '#sum' do subject(:stats) { described_class.new([2,4,4,4,5,5,7,9]) } describe '#sum' do subject { super().sum } it { is_expected.to eq(40) } end # see: http://en.wikipedia.org/wiki/Standard_deviation end describe '#mean' do subject(:stats) { described_class.new([2,4,4,4,5,5,7,9]) } describe '#mean' do subject { super().mean } it { is_expected.to eq(5) } end # see: http://en.wikipedia.org/wiki/Standard_deviation end describe '#sample_variance' do subject(:stats) { described_class.new([2,4,4,4,5,5,7,9]) } describe '#sample_variance' do subject { super().sample_variance } it { is_expected.to eq(4) } end # see: http://en.wikipedia.org/wiki/Standard_deviation end describe '#std_dev' do subject(:stats) { described_class.new([2,4,4,4,5,5,7,9]) } describe '#std_dev' do subject { super().std_dev } it { is_expected.to eq(2) } end # see: http://en.wikipedia.org/wiki/Standard_deviation end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wbench-1.1.1 | spec/wbench/stats_spec.rb |