tests/testthat/test_allocations.R

context("Test allocation methods and class")

test_that("Can load allocations file from disk and convert to data frame",{
  # Load
  allocs <- read_allocations_file("allocations.json")
  expect_s3_class(allocs, "sleepsimR_allocations")
  expect_named(allocs, "abcd")
  expect_length(allocs, 1)
  expect_length(allocs[[1]], 4)
  expect_named(allocs[[1]], c("iteration_id", "ts_request", "ts_finished", "runtime_minutes"))
  # Compute average runtime
  ar <- round(average_runtime(allocs),2)
  expect_equal(ar, 0.04)
})
JasperHG90/sleepsimReval documentation built on May 16, 2020, 2:35 a.m.