tests/testthat/test-hill_val.R

test_that("spot check", {
  max <- 100
  expect_equal(hill_val(10,  max, 10, 1),  max /  2)
  expect_equal(hill_val( 3,  max,  9, 1),  max /  4)
  expect_equal(hill_val( 1, -max,  9, 1), -max / 10)
  expect_equal(hill_val( 5,  max, 10, 2),  max /  5)
})

test_that("corner cases", {
  expect_equal(hill_val(c(0, 5, Inf), 2, 5, 1), 0:2)
})

test_that("negatives", {
  expect_error(hill_val(-1, 2,  1, 1))
  expect_error(hill_val( 1, 2, -1, 1))
})

Try the GeoTox package in your browser

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

GeoTox documentation built on April 4, 2025, 5:07 a.m.