Skip to content

Commit

Permalink
Pass R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul R. Hibbing committed Dec 5, 2020
1 parent 80dcc24 commit ac1456d
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 3 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Imports:
stringr (>= 1.3.0),
tools,
utils,
readr
readr,
RSQLite,
DBI
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Expand Down
2 changes: 1 addition & 1 deletion R/read_agd.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' @export
#'
#' @examples
#' agd_file <- system.file("example1sec.csv", package = "AGread")
#' agd_file <- system.file("extdata", "example1sec.agd", package = "AGread")
#' read_agd(agd_file, "both")
read_agd <- function(
file, return = c("data", "settings", "both"), tz = "UTC", verbose = FALSE
Expand Down
4 changes: 4 additions & 0 deletions man/read_agd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added tests/testthat/agd_read_cache.rds
Binary file not shown.
47 changes: 47 additions & 0 deletions tests/testthat/test_agd.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
context("agd file reading")
library(AGread)

## MANUAL LEGACY TEST (verified 2/14/19)
# AG_legacy <- readRDS("data-raw/counts_legacy.rds")
# AG <- read_AG_counts(
# system.file(
# "extdata", "example1sec.csv", package = "AGread"
# ), verbose = TRUE, skip = 11
# )
# > all.equal(AG, AG_legacy)
# [1] TRUE

testthat::test_that("agd file reading produces expected output", {

agd <- system.file(
"extdata", "example1sec.agd", package = "AGread"
)

csv <- system.file(
"extdata", "example1sec.csv", package = "AGread"
)

test <- read_agd(agd)
ref <- read_AG_counts(csv)

testthat::expect_equal_to_reference(
test, "agd_read_cache.rds"
)

test2 <- read_agd(agd, "settings")
test3 <- read_agd(agd, "data")
test4 <- read_agd(agd, "both")

format_test <- all(
identical(test, test3),
identical(test, test4$data),
identical(test2, test4$settings),
identical(class(test), class(ref)),
identical(class(test4$data), class(ref))
)

testthat::expect_true(format_test)

testthat::expect_equal(test, ref, scale = 1)

})
2 changes: 1 addition & 1 deletion tests/testthat/test_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library(AGread)
# > all.equal(AG, AG_legacy)
# [1] TRUE

testthat::test_that("File reading produces expected output", {
testthat::test_that("csv file reading produces expected output", {
testthat::expect_equal_to_reference(
read_AG_counts(
system.file(
Expand Down

0 comments on commit ac1456d

Please sign in to comment.