tests/testthat/test-permutations.R

test_that("computation of permutations works", {
  expect_equal(
    permutations(1:3),
    list(1:3, c(1L, 3L, 2L), c(2L, 1L, 3L), c(2L, 3L, 1L), c(3L, 1L, 2L), 3:1)
  )
  expect_equal(
    permutations(LETTERS[1:3]),
    list(
      c("A", "B", "C"), c("A", "C", "B"), c("B", "A", "C"), c("B", "C", "A"),
      c("C", "A", "B"), c("C", "B", "A")
    )
  )
})

Try the oeli package in your browser

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

oeli documentation built on Oct. 16, 2024, 5:08 p.m.