context("norm_vector returns correct lengths")
test_that("norm vector returns errors when needed",{
expect_error(norm_vector("string"))
expect_error(norm_vector(0))
})
test_that("norm vector returns expected lengths",{
expect_equal(norm_vector(c(1, 1)), 1.414214, tolerance = 1e-3)
expect_equal(norm_vector(c(1, 0)), 1, tolerance = 1e-3)
expect_equal(norm_vector(c(0,0)), 0, tolerance = 1e-3)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.