tests/testthat/test_checkHeight_output.R

require(students)
context("Students checks")

test_that("input and output have same observations", {
  expect_equal(nrow(students), nrow(checkHeight(students)))
})

test_that("check if sex.specific works fine", {
  test_data <- students
  test_data$sex <- rep("M", times=nrow(students))
  expect_equal(checkHeight(students, sex.specific=FALSE), checkHeight(test_data))
})

test_that("error is thrown when variables are missing", {
  Sys.setenv(LANG = "en")
  has_names(names(students))
})

test_that("printed message is right", {
  prints_text("Yippie, I calculated the mean differences!")
})
redichh/checkHeight documentation built on May 29, 2019, 8:06 a.m.