Sha256: a7dadd34790b8511df5400844c7934a66b2c717f5c407a542c3c293554d4ea0d

Contents?: true

Size: 592 Bytes

Versions: 6

Compression:

Stored size: 592 Bytes

Contents

require 'rspectacular'
require 'ruby-progressbar/calculators/running_average'

class           ProgressBar
module          Calculators
RSpec.describe  RunningAverage do
  it 'can properly calculate a running average' do
    first_average = RunningAverage.calculate(4.5,  12,  0.1)
    expect(first_average).to be_within(0.001).of 11.25

    second_average = RunningAverage.calculate(8.2,  51,  0.7)
    expect(second_average).to be_within(0.001).of 21.04

    third_average = RunningAverage.calculate(41.8, 100, 0.59)
    expect(third_average).to be_within(0.001).of 65.662
  end
end
end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/ruby-progressbar-1.8.1/spec/ruby-progressbar/calculators/running_average_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/ruby-progressbar-1.8.1/spec/ruby-progressbar/calculators/running_average_spec.rb
progressbar-1.8.2 spec/ruby-progressbar/calculators/running_average_spec.rb
progressbar-1.8.1 spec/ruby-progressbar/calculators/running_average_spec.rb
ruby-progressbar-1.8.1 spec/ruby-progressbar/calculators/running_average_spec.rb
ruby-progressbar-1.8.0 spec/ruby-progressbar/calculators/running_average_spec.rb