tests/testthat/test-table_getNearestDistance.R

context("table_getNearestDistance")

test_that("table_getNearestDistance() works", {
  locationTbl <- get(data("wa_monitors_500"))
  
  # Wenatchee
  lon <- -120.325278
  lat <- 47.423333
  
  testClose <- table_getNearestDistance(locationTbl, lon, lat, distanceThreshold = 100)
  testFar <- table_getNearestDistance(locationTbl, lon, lat, distanceThreshold = 10000)
  expect_equal(testClose, as.numeric(NA))
  expect_equal(testFar, 1495, tolerance = 1.0)
})
MazamaScience/MazamaLocationUtils documentation built on Jan. 26, 2024, 3:16 p.m.