tests/testthat/test-function-hsToPosix.R

#
# This test file has been generated by kwb.test::create_test_files()
#

test_that("hsToPosix() works", {

  kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = 1)
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = 1:2)
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = "a")
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = c("a", "b"))
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = TRUE)
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = FALSE)
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = as.POSIXct("2018-06-03 23:50:00"))
   kwb.datetime:::hsToPosix(datetime = as.POSIXct("2018-06-03 23:50:00"), ... = list(key = c("a", "b"), value = 1:2))
   expect_error(
    kwb.datetime:::hsToPosix(datetime = 1, ... = 1)
    # datetime is not of one of the supported classes 'character', 'Date', 'POSIXt'
  )
   expect_error(
    kwb.datetime:::hsToPosix(datetime = "a", ... = 1)
    # character string is not in a standard unambiguous format
  )

})
KWB-R/kwb.datetime documentation built on July 9, 2021, 10:28 p.m.