Sha256: 89baff8522ccaf12ef9995dee77387ee3807519f6348da09cd82adadf76aa14d

Contents?: true

Size: 759 Bytes

Versions: 8

Compression:

Stored size: 759 Bytes

Contents

$:.unshift(File.dirname(__FILE__)+"/../../lib")
require 'benchmark'

#
# Model

class Room
  attr_reader :name
  def initialize(name)
    @name = name
  end
end

#
# Riot

require 'riot'

context "a room" do
  setup { Room.new("bed") }

  asserts("name") { topic.name }.equals("bed")
end # a room

#
# MiniTest::Unit

require 'rubygems'
require 'minitest/unit'

class RoomTest < MiniTest::Unit::TestCase
  def setup
    @room = Room.new("bed")
  end

  def test_room_should_be_named_bed
    assert_equal "bed", @room.name
  end
end

#
# Benchmarking

n = 100 * 100

Benchmark.bmbm do |x|
  x.report("Riot") do
    Riot.silently!
    n.times { Riot.run }
  end

  x.report("MiniTest") do
    n.times { RoomTest.new("Blah").run(MiniTest::Unit.new) }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
riot-0.10.10 test/benchmark/riot_vs_minitest.rb
riot-0.10.9 test/benchmark/riot_vs_minitest.rb
riot-0.10.8 test/benchmark/riot_vs_minitest.rb
riot-0.10.7 test/benchmark/riot_vs_minitest.rb
riot-0.10.6 test/benchmark/riot_vs_minitest.rb
riot-0.10.5 test/benchmark/riot_vs_minitest.rb
riot-0.10.4 test/benchmark/riot_vs_minitest.rb
riot-0.10.3 test/benchmark/riot_vs_minitest.rb