Sha256: c02f694590f569be318ef96e3f8e33337853e587f711c748de38dfbca404711d

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

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

module Mach5
  describe Benchmark do
    before(:each) do
      @memory = Hash.new
      @tags = Hash.new
      @benchmark = Benchmark.new(@memory, @tags)
    end

    it "should find benchmarks by commit id" do
      @memory.should_receive("[]").with("ab7c4351a13b29ea4c21e3662f9f567ff19a854d").and_return(["HMMDishonestCasino.Evaluate", "HMMDishonestCasino.Viterbi"])
      @benchmark["ab7c4351a13b29ea4c21e3662f9f567ff19a854d"]
    end

    it "should find benchmarks by tag" do
      @memory.should_receive("[]").with("v1.0.1").and_return(nil)
      @tags.should_receive("[]").with("v1.0.1").and_return("ab7c4351a13b29ea4c21e3662f9f567ff19a854d")
      @memory.should_receive("[]").with("ab7c4351a13b29ea4c21e3662f9f567ff19a854d")
      @benchmark["v1.0.1"]
    end

    it "should add benchmarks by commit id" do
      commit_list = double("CommitList")
      commit_list.should_receive("<<").with("HMMDishonestCasino.Evaluate")
      @memory.stub("[]").and_return(commit_list)
      @benchmark.add('ab7c4351a13b29ea4c21e3662f9f567ff19a854d', "HMMDishonestCasino.Evaluate")
    end

    it "should tag commits" do
      @tags.should_receive("[]=").with("v1.0.1", "ab7c4351a13b29ea4c21e3662f9f567ff19a854d")
      @benchmark.tag("ab7c4351a13b29ea4c21e3662f9f567ff19a854d", "v1.0.1")
    end

    it "should verify if there is the given tag" do
      @benchmark.tag("ab7c4351a13b29ea4c21e3662f9f567ff19a854d", "v1.0.1")
      @benchmark.has_tag?("ab7c4351a13b29ea4c21e3662f9f567ff19a854d").should be == "v1.0.1"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mach5-tools-0.3.0 spec/benchmark_spec.rb
mach5-tools-0.2.2 spec/benchmark_spec.rb
mach5-tools-0.2.1 spec/benchmark_spec.rb