tests/testthat/test-invyrfraction.R

test_that("inyrfraction works", {
  expect_equal(invyrfraction(c(0,0.5,1),type="hourly"),c("Hour = 0","Hour = 12","Hour = 24"))
  expect_equal(invyrfraction(c(0,0.5,1),type="monthly"),c("Month = 1","Month = 7","Month = 13"))   
  expect_equal(invyrfraction(c(0,0.5,1),type="weekly"),c("Week = 1","Week = 27","Week = 53"))
})

## Uses easily visually identifiable year fractions to test 
## if the function correctly maps them to their month/hour/week

Try the season package in your browser

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

season documentation built on March 21, 2022, 9:10 a.m.