tests/testthat/test-hires_time.R

describe("hires_time", {
  skip_on_cran()

  it("returns hi resolution times", {
    # it is hard to test this, we will just sleep and verify the second time is
    # after the first.
    start <- hires_time()
    Sys.sleep(.1)
    end <- hires_time()
    expect_type(start, "double")
    expect_true(end > start)
  })
})

Try the bench package in your browser

Any scripts or data that you put into this service are public.

bench documentation built on May 4, 2023, 5:13 p.m.