test_that("0 dispersion: 1", {
r <- 10
id5 <- 1
expect_equal(calculateDispersion(r, id5), 0)
})
test_that("0 dispersion: 2", {
r <- c(10, 20, 30)
id5 <- c(1, 1, 1)
expect_equal(calculateDispersion(r, id5), 0)
})
test_that("dispersion comparison: 1", {
d1 <- calculateDispersion(c(10, 10), c(1, 2))
d2 <- calculateDispersion( c(10, 10, 10), c(1, 2, 3) )
expect_lte(d1, d2)
})
test_that("dispersion comparison: 2", {
d1 <- calculateDispersion(c(10, 10), c(1, 2))
d2 <- calculateDispersion(c(10, 30), c(1, 2))
expect_gte(d1, d2)
})
test_that("dispersion equality: 1", {
d1 <- calculateDispersion(c(5, 5, 0, 9), c(1, 1, 2, 2))
d2 <- calculateDispersion(c(10, 9), c(3, 4))
expect_equal(d1, d2)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.