tests/testthat/testthat.R

# install.packages('BuildinganRPackage')
library(BuildinganRPackage)
# install.packages('testthat')
library(testthat)

filename <- system.file("extdata", "accident_2015.csv.bz2", package = "BuildinganRPackage")
dataframe2015 <- BuildinganRPackage::fars_read(filename)
class(dataframe2015)

test_that("check data frame", {
  dataframe2015 <- BuildinganRPackage::fars_read(filename)
  expect_that(dataframe2015, is_a("tbl_df"))
})

test_that("check file name", {
  filename <- basename(BuildinganRPackage::make_filename(2013))
  expect_equal(filename, "accident_2013.csv.bz2")
})

test_check("BuildinganRPackage")
Darwinita/BuildinganRPackage documentation built on Aug. 20, 2017, 4:54 p.m.