tests/testthat/test_nnba.R

testthat::test_that("bearing angle works", {
  testthat::expect_equal(nnba(x = rep(1,4),
                    y = c(1, 2.1, 3, 4.1),
                    hs = rep(pi/2, 4)
                    ),
               c(0, 0, pi, pi))

  testthat::expect_equal(nnba(y = rep(1,4),
                    x = c(1, 3, 4.1, 5),
                    hs = rep(pi/4, 4)
                    ),
               c(pi/4, pi/4, pi/4, -3*pi/4))
})

Try the swaRmverse package in your browser

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

swaRmverse documentation built on Oct. 10, 2024, 5:08 p.m.