tests/testthat/test_printer.R

context("Just testing printer functionality")

test_that("Whether printer gives us the same output",{

  set.seed(1)
  res = printer(x=rnorm(5), r = rnorm(5))

  expect_equal(nrow(res), 5)

  cm =colMeans(res)   # the line c(x...) is generated by dput(colMeans)

  # when generate the following line, remebver to keep same order after the set.seed(1)
  # should be the first run
  expect_equal(cm, c(x = 0.129269895004571, r = 0.135135667587365))


  })
ydfang/myrpackage documentation built on Aug. 4, 2020, 7:54 p.m.