tests/testthat/test-package-data.R

test_that("BTflow is the observed monthly USGS streamflow series", {
  data("BTflow", package = "exdqlm", envir = environment())

  expect_s3_class(BTflow, "ts")
  expect_equal(stats::frequency(BTflow), 12)
  expect_equal(as.integer(stats::start(BTflow)), c(1987L, 1L))
  expect_equal(as.integer(stats::end(BTflow)), c(2026L, 3L))
  expect_equal(length(BTflow), 471)
  expect_true(all(is.finite(as.numeric(BTflow))))
  expect_gt(min(as.numeric(BTflow)), 0)
})

test_that("climateIndices exposes the manuscript climate indices", {
  data("climateIndices", package = "exdqlm", envir = environment())

  expect_s3_class(climateIndices, "data.frame")
  expect_named(climateIndices, c("date", "noi", "amo"))
  expect_s3_class(climateIndices$date, "Date")
  expect_equal(nrow(climateIndices), 516)
  expect_equal(min(climateIndices$date), as.Date("1980-01-01"))
  expect_equal(max(climateIndices$date), as.Date("2022-12-01"))
  expect_identical(climateIndices$date, seq(min(climateIndices$date), max(climateIndices$date), by = "month"))
  expect_true(all(stats::complete.cases(climateIndices)))
  expect_true(all(vapply(climateIndices[-1], is.numeric, logical(1))))
})

test_that("BTprec is not shipped in the cleaned package data API", {
  available <- utils::data(package = "exdqlm")$results[, "Item"]
  expect_false("BTprec" %in% available)
})

Try the exdqlm package in your browser

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

exdqlm documentation built on June 5, 2026, 1:06 a.m.