tests/testthat/test-compute_resultant.R

test_that("resultant vector is computed correctly", {
  vector <- data.frame(
    x = c(0, 1, 5, -7),
    y = c(0, -1, 3, -9),
    z = c(0, 0, -8, 10)
  )
  out <- compute_resultant(vector$x, vector$y, vector$z)

  expect_equal(length(out), 4)
  expect_equal(out, c(0, 1.41421356, 9.89949494, 15.16575089))
})

Try the impactr package in your browser

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

impactr documentation built on May 29, 2024, 6:32 a.m.