tests/testthat/test-circle_area.R

context("circle_area")

test_that("circle_area processes numeric values correctly",{
  expect_equal(circle_area(1),pi)
  expect_equal(circle_area(c(1,2)),c(pi,pi*4))
})

test_that("circle_area errors with non-numeric data",{
  expect_error(circle_area("A"))
  expect_error(circle_area(as.factor("A")))
})
HRumgay/myFirstProject documentation built on July 28, 2017, 12:13 a.m.