tests/testthat/test_primes_remainder.R

library(groupdata2)
context("%primes%")

test_that("%primes% returns the right remainders", {
  expect_equal(57 %primes% 5, 4)
  expect_equal(57 %primes% 7, 9)
  expect_equal(63 %primes% 5, 10)
  expect_equal(77 %primes% 2, 0)

  expect_error(
    xpectr::strip_msg(1 %primes% 1),
    xpectr::strip("1 assertions failed:\n * 'start_at' must be smaller than 'size'."),
    fixed = TRUE)

  expect_error(
    xpectr::strip_msg(1 %primes% 0),
    xpectr::strip("1 assertions failed:\n * Variable 'start_at': Must be >= 1."),
    fixed = TRUE)
})

Try the groupdata2 package in your browser

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

groupdata2 documentation built on July 9, 2023, 6:46 p.m.