test_that('get_move_times calculates move times', {
clocks <- c(900, 900, 888, 878, 878, 858)
move_times <- get_move_times(clocks, 8, 'white')
expect_identical(class(move_times), 'numeric')
expect_equal(move_times, c(0, 20, 18))
move_times <- get_move_times(clocks, 8, 'black')
expect_identical(class(move_times), 'numeric')
expect_equal(move_times, c(0, 30, 28))
expect_error(get_move_times(clocks, 8, 'wite'))
clocks <- c(900, 900, 910, 878)
expect_identical(get_move_times(clocks, 8, 'white'), c(0, NA_real_))
expect_identical(
get_move_times(clocks, 8, 'white', negative_time = 'no action'),
c(0, -2)
)
expect_identical(get_move_times(numeric(0), 8, 'white'), numeric(0))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.