tests/testthat/test-sort-by.R

test_that("sort-by() works", {
  x <- runif(10)
  y <- runif(10)

  expect_equal(sort_by(x, x), sort(x))
  expect_equal(sort_by(x, y), x[order(y)])
  expect_equal(sort_by(x, -y), x[flip(order(y))])
})

Try the mark package in your browser

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

mark documentation built on May 29, 2024, 5:13 a.m.