Sha256: b52264cb22218cbc8c8621af5f3a384d9dd54d193b7fb65068f7089d7194df43

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

describe Array do
  let(:floats)   { [1.1, 2.2, 3.3, 4.4, 5.5] }
  let(:integers) { [1, 2, 3, 4, 5] }

  context "with floats" do
    it("#stddev")   { expect(floats.stddev).to   be_within(0.00001).of(1.73925) }
    it("#mean")     { expect(floats.mean).to     be_within(0.00001).of(3.30000) }
    it("#variance") { expect(floats.variance).to be_within(0.00001).of(3.02500) }
  end

  context "with integers" do
    it("#stddev")   { expect(integers.stddev).to   be_within(0.00001).of(1.58113) }
    it("#mean")     { expect(integers.mean).to     be_within(0.00001).of(3.00000) }
    it("#variance") { expect(integers.variance).to be_within(0.00001).of(2.50000) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
more_core_extensions-3.2.0 spec/core_ext/array/math_spec.rb
more_core_extensions-3.1.1 spec/core_ext/array/math_spec.rb
more_core_extensions-3.1.0 spec/core_ext/array/math_spec.rb