tests/testthat/test_stopwatch.R

context("Stopwatch test")
library(dataprocr)
test_that("`stopwatch` should work for all kinds of data input", {
  expect_equal(
    stopwatch(
      jsonlite::read_json("data_stopwatch_normal.json", simplifyVector = TRUE)
    ), 566.8205, tolerance = 1e-4
  )
  expect_equal(
    is.na(
      stopwatch(
        jsonlite::read_json("data_stopwatch_abnormal.json", simplifyVector = TRUE)
      )
    ), TRUE
  )
  expect_equal(is.na(stopwatch(data.frame())), TRUE)
})
psychelzh/dataprocr documentation built on Oct. 12, 2019, 1:50 a.m.