tests/testthat/test-calc_crop_harvest.R

test_that("crops_equal_one", {
  #fake dataset:
  crop_test = sample(1:1, 500, replace = T)
  dates = seq(from = 1920, to = 2010, by = 10)
  locations = c("SB", "LA", "SF","SLO","SD")
  ca_test <- matrix(crop_test, nrow = 10, ncol = 5,
                    dimnames = list(c(dates), c(locations)))

  expect_that(calc_crop_harvest(ca_test, 2, 1)$harvests[1], equals(c('1920' = 1)))

}
)
annaclairemarley/HW5262 documentation built on April 5, 2020, 8:59 p.m.