tests/testthat/test_distanceCaculate.R

context('distance calculating')

test_that('distance returned must be less than 0.5% compared with geosphere::distHaversine', {
  temp <- distanceCaculate(0, 0, 1, 1)
  temp_std <- 157425.5 # geosphere::distHaversine(c(0, 0), c(1, 1))
  error <- abs(temp_std - temp) / temp_std
  expect_lte(error, 0.005)
})
ashther/ashtheR documentation built on May 27, 2019, 11:49 p.m.