context("Move")
test_that("Sample", {
set.seed(12345)
expect_equal(sample1(1:100), 14)
expect_equal(sample1(1:1000), 51)
expect_equal(sample1(10), 10)
})
test_that("Move up", {
expect_equal(move_up(1, 2), 2)
set.seed(54321)
expect_equal(move_up(1:5, 101:105), c(1, 2, 3, 30, 5))
})
test_that("Move up", {
set.seed(6789)
x <- c(2, 10, 20)
expect_equal(move_up_down(x, c(1, 5, 15), c(4, 14, 30)), c(1, 10, 24))
for(i in 1:10){
new <- move_up_down(x, c(1, 5, 15), c(4, 14, 30))
dif <- new - x
dif
expect_equal(sum(dif > 0), 1)
expect_equal(sum(dif < 0), 1)
expect_equal(sum(dif == 0), 1)
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.