context("Test cache consistency between types")
test_that("Caches consistent", {
dc <- DiskCache$new()
sc <- SqliteCache$new()
mc <- MemoryCache$new()
n <- 10
for (i in seq(n)) {
dc$set(i, mtcars[1 : n, ])
sc$set(i, mtcars[1 : n, ])
mc$set(i, mtcars[1 : n, ])
}
all_true <- TRUE
for (i in seq(n)) {
all_true <-
all_true &&
identical(dc$get(i), sc$get(i)) &&
identical(sc$get(i), mc$get(i))
}
expect_true(all_true)
# clean up
dc$destroy()
sc$destroy()
mc$destroy()
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.