context("Check that correct date-of-birth is computed")
cpr <- c("1010101234",
"1010102234",
"1010103234",
"1010364234",
"1010374234",
"1010575234",
"1010585234",
"1010576234",
"1010586234",
"1010577234",
"1010587234",
"1010578234",
"1010588234",
"1010369234",
"1010379234"
)
truedob <- as.Date(c("1910-10-10",
"1910-10-10",
"1910-10-10",
"2036-10-10",
"1937-10-10",
"2057-10-10",
"1858-10-10",
"2057-10-10",
"1858-10-10",
"2057-10-10",
"1858-10-10",
"2057-10-10",
"1858-10-10",
"2036-10-10",
"1937-10-10"))
illegaldates <- c("3210101234",
"1000102234",
"1013103234",
"3213364234"
)
test_that("Illegal dates are NA", {
expect_warning(illegal <- date_of_birth(illegaldates))
expect_equal(all(is.na(illegal)), TRUE)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.