# Work in progress. The book on R packages only mentions examples
# of tests for functions, so make sure to have a look at some test-
# directories of data-focused packages like covdata. Creating tests
# for data is very different from creating tests for functions.
# context("Datasets")
library(primer.data)
library(stringr)
cces
test_that("str_length is number of characters", {
expect_equal(str_length("a"), 1)
expect_equal(str_length("ab"), 2)
expect_equal(str_length("abc"), 3)
})
test_that("no rows with same value for every variable", {
expect_equal(str_length(factor("a")), 1)
expect_equal(str_length(factor("ab")), 2)
expect_equal(str_length(factor("abc")), 3)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.