Skip to content

Commit

Permalink
use return_units arg
Browse files Browse the repository at this point in the history
  • Loading branch information
robitalec committed Dec 6, 2024
1 parent 9bf16a9 commit 113f6de
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/testthat/test-diff-rad.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ pt_02 <- as_units(0.2, 'rad')
pi_rad <- as_units(pi, 'rad')

# Adapted from: https://gist.github.com/bradphelan/7fe21ad8ebfcb43696b8
expect_equal(diff_rad(pt_01, pt_02, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 + 2 * pi_rad, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 - 2 * pi_rad, TRUE), pt_01)
expect_equal(diff_rad(pt_01 + 2 * pi_rad, pt_02, TRUE), pt_01)
expect_equal(diff_rad(pt_01 - 2 * pi_rad, pt_02, TRUE), pt_01)
expect_equal(diff_rad(pt_02, pt_01, TRUE), -pt_01)
expect_equal(diff_rad(pt_02 + 2 * pi_rad, pt_01, TRUE), -pt_01)
expect_equal(diff_rad(pt_02 - 2 * pi_rad, pt_01, TRUE), -pt_01)
expect_equal(diff_rad(pt_02, pt_01 + 2 * pi_rad, TRUE), -pt_01)
expect_equal(diff_rad(pt_02, pt_01 - 2 * pi_rad, TRUE), -pt_01)
expect_equal(diff_rad(pt_01, pt_02, TRUE, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 + 2 * pi_rad, TRUE, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 - 2 * pi_rad, TRUE, TRUE), pt_01)
expect_equal(diff_rad(pt_01 + 2 * pi_rad, pt_02, TRUE, TRUE), pt_01)
expect_equal(diff_rad(pt_01 - 2 * pi_rad, pt_02, TRUE, TRUE), pt_01)
expect_equal(diff_rad(pt_02, pt_01, TRUE, TRUE), -pt_01)
expect_equal(diff_rad(pt_02 + 2 * pi_rad, pt_01, TRUE, TRUE), -pt_01)
expect_equal(diff_rad(pt_02 - 2 * pi_rad, pt_01, TRUE, TRUE), -pt_01)
expect_equal(diff_rad(pt_02, pt_01 + 2 * pi_rad, TRUE, TRUE), -pt_01)
expect_equal(diff_rad(pt_02, pt_01 - 2 * pi_rad, TRUE, TRUE), -pt_01)

expect_equal(diff_rad(pt_01, pt_02, FALSE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 + 2 * pi_rad, FALSE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 - 2 * pi_rad, FALSE), pt_01)
expect_equal(diff_rad(pt_01 + 2 * pi_rad, pt_02, FALSE), pt_01)
expect_equal(diff_rad(pt_01 - 2 * pi_rad, pt_02, FALSE), pt_01)
expect_equal(diff_rad(pt_02, pt_01, FALSE), pt_01)
expect_equal(diff_rad(pt_02 + 2 * pi_rad, pt_01, FALSE), pt_01)
expect_equal(diff_rad(pt_02 - 2 * pi_rad, pt_01, FALSE), pt_01)
expect_equal(diff_rad(pt_02, pt_01 + 2 * pi_rad, FALSE), pt_01)
expect_equal(diff_rad(pt_02, pt_01 - 2 * pi_rad, FALSE), pt_01)
expect_equal(diff_rad(pt_01, pt_02, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 + 2 * pi_rad, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_01, pt_02 - 2 * pi_rad, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_01 + 2 * pi_rad, pt_02, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_01 - 2 * pi_rad, pt_02, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_02, pt_01, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_02 + 2 * pi_rad, pt_01, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_02 - 2 * pi_rad, pt_01, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_02, pt_01 + 2 * pi_rad, FALSE, TRUE), pt_01)
expect_equal(diff_rad(pt_02, pt_01 - 2 * pi_rad, FALSE, TRUE), pt_01)

0 comments on commit 113f6de

Please sign in to comment.