# transient array_op from AFL ----
test_that("array_op from afl", {
skip_if_no_db()
conn = get_scidb_connection()
rawAfl = "apply(list('operators'), extra, 'abc')"
arr = conn$afl_expr(rawAfl)
expect_identical(arr$to_afl(), rawAfl)
expect_equal(arr$attrs, c("name", "library", "extra"))
})
# persistent array_op from stored AFL ----
test_that("persistent array_op from stored AFL", {
skip_if_no_db()
conn = get_scidb_connection()
rawAfl = "apply(list('operators'), extra, 'abc')"
name = dbutils$random_array_name()
storedArr = conn$afl_expr(rawAfl)$persist(name)
retrievedArr = conn$array(name)
expect_identical(storedArr$to_afl(), name)
expect_equal(
storedArr$to_df(),
retrievedArr$to_df()
)
storedArr$remove_array()
})
test_that("persistent array_op from stored AFL", {
skip_if_no_db()
conn = get_scidb_connection()
rawAfl = "apply(list('operators'), extra, 'abc')"
storedArr = conn$afl_expr(rawAfl)$persist(.temp = T, .gc = F)
is_array_temp = storedArr$array_meta_data()$temporary
expect_identical(is_array_temp, TRUE)
storedArr$remove_array()
})
# From transient to persistent ----
test_that("store transient array_op from afl as a persistent one", {
skip_if_no_db()
conn = get_scidb_connection()
rawAfl = "apply(list('operators'), extra, 'abc')"
name = dbutils$random_array_name()
conn$execute(afl(rawAfl | store(name)))
transientArr = conn$afl_expr(rawAfl)
storedArr = conn$array(name)
expect_identical(transientArr$to_afl(), rawAfl)
expect_identical(storedArr$to_afl(), name)
expect_identical(storedArr$attrs, transientArr$attrs)
expect_equal(
storedArr$to_df(),
transientArr$to_df()
)
storedArr$remove_array()
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.