tests/testthat/test-thousands.R

context("thousands")

test_that("thousands format always adds k", {
    expect_equal(thousands(1000), "1k")
    expect_equal(thousands(1e+06), "1,000k")
    expect_equal(thousands(1e+09), "1,000,000k")
})

test_that("thousands_format format always adds k", {
  expect_equal(thousands_format()(1000), "1k")
  expect_equal(thousands_format()(1e+06), "1,000k")
  expect_equal(thousands_format()(1e+09), "1,000,000k")
})

Try the optiRum package in your browser

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

optiRum documentation built on May 5, 2022, 1:05 a.m.