context("Label stage")
guesses <- data_frame(SessionID = "S",
SessionTime = 1:3,
PrevTeamInventoryID = "1",
PrevSessionInventoryID = c("", "1", "1-2"))
test_that("label diachronic stage", {
r <- guesses %>% mutate(Strategy = "Diachronic") %>% label_stage()
expect_equal(r$Stage, c("learning", "playing", "playing"))
})
test_that("label synchronic stage", {
r <- guesses %>% mutate(Strategy = "Synchronic") %>% label_stage()
expect_equal(r$Stage, c("learning", "playing", "playing"))
})
context("Verify stage")
data("Guesses")
test_that("I50 players are only in stage 'playing'", {
I50 <- dplyr::filter(Guesses, Strategy == "Isolated", SessionDuration == 50)
expect_true(all(I50$Stage == "playing"))
})
test_that("DG1 players are only in stage 'playing'", {
DG1 <- dplyr::filter(Guesses, Strategy == "Diachronic", Generation == 1)
expect_true(all(DG1$Stage == "playing"))
})
context("Label stage time")
test_that("stage time is centered on stage ix", {
result <- guesses %>% label_stage() %>% label_stage_time()
expect_equal(result$StageTime, c(0, 1, 2))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.