Sha256: 5ff9b37a4ad0747732beee918f240d5fc9db356cf405fd4552ab4616969d4b06
Contents?: true
Size: 753 Bytes
Versions: 1
Compression:
Stored size: 753 Bytes
Contents
require 'spec_helper' median_expectations = { [] => nil, [1] => 1.0, [1.0] => 1.0, [1, -1] => 0.0, [1, 2, 3000] => 2.0, [1, 2, 3000.0] => 2.0, [2, 2, 3000.0] => 2.0, (0...0) => nil, (1..1) => 1.0, (0..3) => 1.5, [BigDecimal("0.0")] => 0.0, [-2, BigDecimal("1.0")] => -0.5 } describe Enumerable do describe "#median" do median_expectations.each do |data, expected| it "is #{expected.inspect} for #{data.inspect}" do median = data.median median.should == expected median.class.should == expected.class end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_stats-1.0.0 | spec/enumerable/median_spec.rb |