tests/testthat/test-specify_decimal.R

context('functions')

test_that('specify_decimal', {

  # round off positive number
  expect_equal(as.numeric(specify_decimal(3.45178,2)), 3.45)

  # round up positive number
  expect_equal(as.numeric(specify_decimal(3.45678,2)), 3.46)

  # round off negative number
  expect_equal(as.numeric(specify_decimal(-3.45178,2)), -3.45)

  # round up negative number
  expect_equal(as.numeric(specify_decimal(-3.45678,2)), -3.46)


})

Try the monotonicity package in your browser

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

monotonicity documentation built on Dec. 5, 2019, 5:08 p.m.