context("Testuje konwersje jednostek")
test_that("czy dobre wartości",{
expect_equal(dystans(1, "cm", "m"), 0.01)
expect_equal(dystans(1, "inch", "cm"), 2.54)
expect_equal(dystans(c(1,4,5), "m", "cm"), c(100, 400, 500))
})
test_that("czy dobry format", {
expect_is(dystans(1, "cm", "m"), "numeric")
expect_is(dystans(mtcars, "cm", "m"), "data.frame")
})
test_that("czy dobre bledy", {
expect_error(dystans())
expect_error(dystans("a", "cm", "m"))
expect_error(dystans(1, "cm", "metr"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.