context("test-paths")
test_that("directions_to_seqs work", {
paths <- list(c("left", "left", "right", "right"),
c("left", "left", "left", "right"),
c("left", "left", "left", "left"))
expect_equal(lapply(directions_to_seqs(paths), function(x) x$seq),
list(S = c("left", "left"),
S0 = "left",
S1 = c("right", "right"),
S00 = "left",
S01 = "right"))
})
test_that("directions_to_seqs records path correctly", {
paths <- list(c("left", "left", "right", "right"),
c("left", "left", "left", "right"),
c("left", "left", "left", "left"))
expect_equal(lapply(directions_to_seqs(paths), function(x) x$path),
list(S = c(1, 2, 3),
S0 = c(2, 3),
S1 = 1,
S00 = 3,
S01 = 2))
})
test_that("seqs_to_paths works as intended", {
paths <- list(c("left", "left", "right", "right"),
c("left", "left", "left", "right"),
c("left", "left", "left", "left"))
seqs <- directions_to_seqs(paths)
expect_equal(seqs_to_paths(seqs),
list(c("S", "S1"),
c("S", "S0", "S01"),
c("S", "S0", "S00")))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.