Sha256: 1ba7f98830219b88fe1745433412d103ec72059bcc7c89f527089c65a4a3cc07

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

require File.dirname(__FILE__) + '/../../../helper'
require "test/unit"
require 'jinx/helpers/stopwatch'

class StopwatchTest < Test::Unit::TestCase
  def setup
    @timer = Jinx::Stopwatch.new
  end
  
  def test_run
    t1 = @timer.run { 1000000.times { " " * 100 } }
    t2 = @timer.run { 1000000.times { " " * 100 } }
    assert_equal(t1.elapsed + t2.elapsed, @timer.elapsed, "Elapsed time incorrectly accumulated")
    assert_equal(t1.cpu + t2.cpu, @timer.cpu, "CPU time incorrectly accumulated")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jinx-2.1.4 test/lib/jinx/helpers/stopwatch_test.rb
jinx-2.1.3 test/lib/jinx/helpers/stopwatch_test.rb
jinx-2.1.2 test/lib/jinx/helpers/stopwatch_test.rb
jinx-2.1.1 test/lib/jinx/helpers/stopwatch_test.rb