tests/testthat/test-pin_century.R

today_pin <- substr(paste(paste(unlist(strsplit(as.character(Sys.Date()),split = "-")), collapse = ""),"0000",sep=""), 3, 12)
tomorrow_pin <- substr(paste(paste(unlist(strsplit(as.character(Sys.Date()+1),split = "-")), collapse = ""),"0000",sep=""), 3, 12)

context("pin_century")

test_that(desc="century",{
  expect_equal(pin_century(pin = today_pin), expected = 20)
  expect_equal(pin_century(pin = tomorrow_pin), expected = 19)
  expect_is(pin_century(pin = today_pin), "numeric")
})

Try the sweidnumbr package in your browser

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

sweidnumbr documentation built on March 31, 2020, 5:24 p.m.