tests/testthat/test-round5.R

test_that("round5() works", {
  expect_snapshot({
    x <- seq.int(-10L, 10L, by = 1L) / 2
    x <- x[x %% 1 != 0] # remove integers
    round5(x) |> setNames(nm = x)
  })

  expect_snapshot({
    x <- seq.int(-100000L, 100000L, by = 10000L) - 1L / 2L
    x <- x[x %% 1 != 0] # remove integers
    round5(x) |> setNames(nm = x)
  })

  expect_snapshot({
    x <- seq.int(-100000L, 100000L, by = 10000L) + 1L / 2L
    x <- x[x %% 1 != 0] # remove integers
    round5(x) |> setNames(nm = x)
  })
})

Try the cards package in your browser

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

cards documentation built on Oct. 4, 2024, 1:09 a.m.