context("add_inventory")
test_that("Add inventory modifies state", {
create_time <- lubridate::parse_date_time("2016-01-01", "ymd")
tag_percent <- .05
state <- inialize_state()
state <- add_inventory(state, 1, 1, create_time, tag_percent)
expect_equal(state[["movement"]]$datetime[1], create_time)
state <- add_inventory(state, 1, 199, create_time, tag_percent)
expect_equal(nrow(state[["population"]]), 200)
expect_equal(nrow(state[["movement"]]), 200)
state <- add_inventory(state, 2, 200, create_time, tag_percent)
expect_equal(nrow(state[["population"]]), 400)
expect_equal(nrow(state[["movement"]]), 400)
expect_true(all(state[[c("movement", "clean")]]))
pieces <- state[[c("population", "piece")]]
expect_equal(length(pieces), length(unique(pieces)))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.