Sha256: 0355e44ad1cdd24fa322c19bf57dea7a214de2463f8c4723569fcc9359a19cff

Contents?: true

Size: 674 Bytes

Versions: 30

Compression:

Stored size: 674 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
require 'madvertise/ext/enumerable'

describe Enumerable do

  it "should support the sum for a list of numbers" do
    [1,2,3,4,5].sum.should == 15
  end

  it "should support the mean for a list of numbers" do
    [1,2,3,4,5].mean.should == 3.0
  end

  it "should support the variance for a list of numbers" do
    [9,8,7,6,5].variance.should == 2.5
  end

  it "should support the standard deviation for a list of numbers" do
    [9,8,7,6,5].stdev.should == 1.5811388300841898
  end

  it "should support a percentile method for a list of numbers" do
    [9,1,8,2,7,3,6,4,5,4,3,2,1].percentile(0.9).should == 8
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
madvertise-ext-0.5.1 spec/enumerable_spec.rb
madvertise-ext-0.5.0 spec/enumerable_spec.rb
madvertise-ext-0.4.0 spec/enumerable_spec.rb
madvertise-ext-0.3.0 spec/enumerable_spec.rb
madvertise-ext-0.2.2 spec/enumerable_spec.rb
madvertise-ext-0.2.0 spec/enumerable_spec.rb
madvertise-ext-0.1.3 spec/enumerable_spec.rb
madvertise-ext-0.1.2 spec/enumerable_spec.rb
madvertise-ext-0.1.1 spec/enumerable_spec.rb
madvertise-ext-0.1.0 spec/enumerable_spec.rb