File: hitimes_spec.rb

package info (click to toggle)
ruby-hitimes 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 352 kB
  • sloc: ruby: 1,196; ansic: 418; java: 265; makefile: 15
file content (25 lines) | stat: -rw-r--r-- 525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'spec_helper'

describe Hitimes do
  it "can time a block of code" do
    skip
    d = Hitimes.measure do
      sleep 0.2
    end
    d.must_be_close_to(0.2, 0.002)
  end

  it "raises an error if measure is called with no block" do
    lambda{ Hitimes.measure }.must_raise( Hitimes::Error )
  end

  it "has the raw instant value" do
    v = Hitimes.raw_instant
    v.must_be :>, 0
  end

  it "has access to the instant conversion factor" do
    f = Hitimes::INSTANT_CONVERSION_FACTOR
    f.must_be :>, 0
  end
end