tests/testthat/test-atbash.R

test_that("Letters are flipped", {
  expect_equal(atbash("az"), "za")
})

test_that("Spaces are preserved", {
  expect_equal(atbash("a b c"), "z y x")
})
test_that("Punctuation is preserved", {
  expect_equal(atbash("a.b"), "z.y")
})

test_that("Vector length is preserved", {
  expect_equal(atbash(c("a", "b", "c")), c("z", "y", "x"))
})

test_that("Must be a character vector of length greater than zero", {
  expect_error(atbash(c(TRUE)))
  expect_error(atbash(c(123)))
  expect_error(atbash(c()))
})

Try the cipheR package in your browser

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

cipheR documentation built on Nov. 16, 2022, 5:15 p.m.