tests/testthat/test_sun.rise.set.R

context("sun.rise.set()")
library(LakeMetabolizer)

testthat::test_that("Return object class and format", {
  
  # Run sun.rise.set() with test data
  dates <- as.POSIXlt(
    c("2020-08-22", "2020-08-23", "2020-08-24"),
    tz = "America/Chicago")
  r <- sun.rise.set(dates, lat = 41.8781)
  
  # Returned object is a data frame
  expect_equal(class(r), "data.frame")
  
  # Index order is preserved from original implmentation
  expect_equal("sunrise", colnames(r)[1])
  expect_equal("sunset", colnames(r)[2])
  
  # Input time zone attribute is returned
  expect_true(attr(r$sunrise, "tzone") == "America/Chicago")
  
})

Try the LakeMetabolizer package in your browser

Any scripts or data that you put into this service are public.

LakeMetabolizer documentation built on Nov. 16, 2022, 1:09 a.m.