Sha256: def0a8b2f9bf543c99cb8fc295f1d13bfea05f2da72a8b1a5d48c444cb660eb3

Contents?: true

Size: 659 Bytes

Versions: 7

Compression:

Stored size: 659 Bytes

Contents

require "spec_helper"

describe MetricFu::Ranking do

  context "with many items" do

    specify "#top" do
      ranking = Ranking.new
      ranking[:a] = 10
      ranking[:b] = 50
      ranking[:c] = 1
      ranking.top.should == [:b,:a, :c]
    end

    specify "lowest item is at 0 percentile" do
      ranking = Ranking.new
      ranking[:a] = 10
      ranking[:b] = 50
      ranking.percentile(:a).should == 0
    end

    specify "highest item is at high percentile" do
      ranking = Ranking.new
      ranking[:a] = 10
      ranking[:b] = 50
      ranking[:c] = 0
      ranking[:d] = 5
      ranking.percentile(:b).should == 0.75
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
metric_fu-4.6.0 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.5.2 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.5.1 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.4.4 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.4.3 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.4.2 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb
metric_fu-4.4.1 spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb