Sha256: 286381aa4b0f0bab31c1314bf5e95226b89d793d1192da465a89c99e044a58e6

Contents?: true

Size: 656 Bytes

Versions: 18

Compression:

Stored size: 656 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

module ArrayMath
  describe "ArrayMath" do
    context "Sum" do
      it "sums an array" do
        array = [1,2,3,4,5]
        array.asum.should == 15
      end
      it "can not sum an array of strings" do
        array = ["hello", "goodbye"]
        array.asum.should == nil
      end
    end
    context "average" do
      it "averages an array of integers and returns a float" do
        array = [2,3,4,3,2]
        array.aaverage.should == 2.8
      end
      it "averages an array of floats" do
        array = [1.5,2.5,3.5,2.5,1.5]
        array.aaverage.should == 2.3
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
teich-hrmparser-0.2.1 spec/arraymath_spec.rb
teich-hrmparser-0.2.2 spec/arraymath_spec.rb
teich-hrmparser-0.3.0 spec/arraymath_spec.rb
teich-hrmparser-0.3.1 spec/arraymath_spec.rb
teich-hrmparser-0.4.0 spec/arraymath_spec.rb
teich-hrmparser-0.4.1 spec/arraymath_spec.rb
teich-hrmparser-0.4.2 spec/arraymath_spec.rb
teich-hrmparser-0.4.3 spec/arraymath_spec.rb
teich-hrmparser-0.4.4 spec/arraymath_spec.rb
teich-hrmparser-0.4.5 spec/arraymath_spec.rb
teich-hrmparser-0.4.6 spec/arraymath_spec.rb
teich-hrmparser-0.4.7 spec/arraymath_spec.rb
teich-hrmparser-0.4.8 spec/arraymath_spec.rb
teich-hrmparser-0.4.9 spec/arraymath_spec.rb
teich-hrmparser-0.5.0 spec/arraymath_spec.rb
teich-hrmparser-0.6.0 spec/arraymath_spec.rb
hrmparser-0.7.0 spec/arraymath_spec.rb
hrmparser-0.6.0 spec/arraymath_spec.rb