unit testing in R - smart1004/r_lan GitHub Wiki
https://dzone.com/articles/example-unit-testing-r-code
Example of unit testing R code with testthat
https://katherinemwood.github.io/post/testthat/
https://github.com/r-lib/testthat/blob/master/tests/testthat/test-expect-output.R
http://r-pkgs.had.co.nz/tests.html
How to write a testthat unit test for a function that returns a data frame
https://stackoverflow.com/questions/29282994/how-to-write-a-testthat-unit-test-for-a-function-that-returns-a-data-frame/30223742
----------------------------- 소스코드 내용 ----- #https://katherinemwood.github.io/post/testthat/
testing_data <- data.frame('letters'=c('a', 'b', 'c', 'd'),
'numbers'=seq(1, 4))
print(testing_data)
library(testthat)
source("testing_data.R")
context('testing data integrity')
test_that('data dimensions correct', { expect_equal(ncol(testing_data), 2) expect_equal(nrow(testing_data), 4) })