tests/testthat/test_regional_curve.R

test_that("Check that key fields exist by name", {
  expect_true("region_name" %in% colnames(regional_curve))
  expect_true("state" %in% colnames(regional_curve))
  expect_true("dimension" %in% colnames(regional_curve))
  expect_true("intercept" %in% colnames(regional_curve))
  expect_true("slope" %in% colnames(regional_curve))
  expect_true("r_squared" %in% colnames(regional_curve))
  expect_true("no_sites" %in% colnames(regional_curve))
  expect_true("drainage_area_range" %in% colnames(regional_curve))
  expect_true("recurrence_range" %in% colnames(regional_curve))
  expect_true("median_recurrence" %in% colnames(regional_curve))
  expect_true("reference" %in% colnames(regional_curve))
})

test_that("Check that key fields are of the correct data type", {
  expect_true(is.factor(regional_curve$region_name))
  expect_true(is.character(regional_curve$state))
  expect_true(is.factor(regional_curve$dimension))
  expect_true(is.numeric(regional_curve$intercept))
  expect_true(is.numeric(regional_curve$slope))
  expect_true(is.numeric(regional_curve$r_squared))
  expect_true(is.numeric(regional_curve$no_sites))
  expect_true(is.character(regional_curve$drainage_area_range))
  expect_true(is.character(regional_curve$recurrence_range))
  expect_true(is.character(regional_curve$median_recurrence))
  expect_true(is.character(regional_curve$reference))
})
FluvialGeomorph/RegionalCurve documentation built on Oct. 2, 2023, 9:35 a.m.