tests/testthat/test_utils.R

context("utils tests")

test_that("server_address return a string", {
  subdomain <- "main"
  exp_address <- "main.hydroscope.gr"

  expect_equal(server_address(subdomain), exp_address)
})

test_that("server_alive fails", {
  subdomain <- "xxx"
  expect_error(server_alive(subdomain))
})


test_that("degrees are converted to rads", {
  degr <- 180
  expect_equal(object = deg_to_rads(degr), pi)
})

test_that("computing distance with Haversine Formula", {
  expect_equal(haversine(37.5, 22, 37.5, 23), 88.244145)
})

Try the hydroscoper package in your browser

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

hydroscoper documentation built on May 14, 2021, 5:08 p.m.