tests/testthat/test_ch_wtr_yr.R

context("Testing ch_wtr_yr")

test_that("ch_wtr_yr correctly categorizes water year", {
  month <- 10
  date <- seq(as.Date("1910/1/1"), as.Date("1912/1/1"), "days")
  wtr_yr <- ch_wtr_yr(dates = date, start_month = month)
  comp_df <- data.frame(wtr_yr,date)
  expect_true(comp_df[comp_df$date == as.Date("1911-10-01"),]$wtr_yr == 1912)
})

Try the CSHShydRology package in your browser

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

CSHShydRology documentation built on Sept. 11, 2024, 5:50 p.m.