context("Count correct answers")
library(dataprocr)
test_that(
"`count_correct` should work for butterfly, digit, firefly and nback", {
expect_equal(
count_correct(
jsonlite::read_json("data_butterfly.json", simplifyVector = TRUE)
), 31
)
expect_equal(
count_correct(
jsonlite::read_json("data_digit.json", simplifyVector = TRUE)
), 54
)
expect_equal(
count_correct(
jsonlite::read_json("data_firefly.json", simplifyVector = TRUE)
), 47
)
expect_equal(
count_correct(
jsonlite::read_json("data_fourback.json", simplifyVector = TRUE)
), 50
)
expect_equal(is.na(count_correct(data.frame())), TRUE)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.