context("Proper conversion")
test_that("Conversions are done properly", {
expect_equal(cm_to(170, "in"), 0.393700787 * 170)
expect_equal(cm_to(170, "m"), 1.7)
expect_equal(cm_to(1, "mile"), 6.213712e-06)
})
test_that("Wrong unit produces NA and warning", {
expect_equal(cm_to(1, ""), NA_real_)
expect_warning(cm_to(1, ""), "incorrect measure unit")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.