File: hitimes_spec.rb

package info (click to toggle)
ruby-hitimes 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: ruby: 1,385; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 528 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
# frozen_string_literal: true

require "spec_helper"

describe Hitimes do
  it "can time a block of code" do
    skip
    d = Hitimes.measure { sleep 0.01 }
    _(d).must_be :>, 0
  end

  it "raises an error if measure is called with no block" do
    _(-> { 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 number of nanosecond" do
    f = Hitimes::NANOSECONDS_PER_SECOND
    _(f).must_be :>, 0
  end
end