Skip to content

Commit

Permalink
fix for testing issues with nrow comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
sebkopf committed May 22, 2017
1 parent cbec708 commit a0f8312
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: lans2r
Title: Work with Look at NanoSIMS Data in R
Description: R interface for working with nanometer scale secondary ion mass
spectrometry (NanoSIMS) data exported from Look at NanoSIMS.
Version: 1.0.1
Version: 1.0.3
Authors@R: person("Sebastian", "Kopf", email = "sebastian.kopf@colorado.edu",
role = c("aut", "cre"))
URL: https://github.com/KopfLab/lans2r
Expand Down
9 changes: 4 additions & 5 deletions tests/testthat/test-load-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ test_that("test that it is possible to load LANS maps", {
base_dir = folder, quiet = T))

# check data
expect_equal({
pixels <- maps %>% select(analysis, frame_size.px, variable) %>% unique() %>%
group_by(analysis) %>% summarize(n = unique(frame_size.px)^2 * length(variable))
sum(pixels$n)
}, nrow(maps))
expect_equal(nrow(maps), as.integer(256^2 * 4 * 3))
# pixels <- maps %>% select(analysis, frame_size.px, variable) %>% unique() %>%
# group_by(analysis) %>% summarize(n = unique(frame_size.px)^2 * length(variable))
# as.integer(sum(pixels$n))

expect_equal(maps$variable %>% unique(), c("12C", "13C", "14N12C", "15N12C"))
expect_equal(maps %>% names(),
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-read-files.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ test_that("test that it is possible to read full ion data file", {
c("x.px", "y.px", "frame_size.px", "x.um", "y.um", "frame_size.um",
"variable", "data_type", "value", "sigma", "ROI"))

expect_equal(data$frame_size.px[1]^2 %>% as.integer(), data %>% nrow())
expect_equal(data %>% nrow(), as.integer(256^2))
#as.integer(data$frame_size.px[1]*data$frame_size.px[1])

expect_equal(data$value[3], 1508) # spot check
expect_equal(data$variable[3], "12C") # spot check
Expand All @@ -80,7 +81,8 @@ test_that("test that it is possible to read all map data in a folder", {

# data checks
expect_equal(data$variable %>% unique(), c("12C", "13C", "14N12C", "15N12C"))
expect_equal(as.integer(data$frame_size.px[1]^2 * length(data$variable %>% unique())), data %>% nrow())
expect_equal(data %>% nrow(), as.integer(256^2 * 4))
#as.integer(data$frame_size.px[1] * data$frame_size.px[1] * length(unique(data$variable)))
expect_equal(data %>% names(), c("x.px", "y.px", "frame_size.px", "x.um", "y.um", "frame_size.um",
"variable", "data_type", "value", "sigma", "ROI"))
expect_equal(data$value[nrow(data)], 4) # spot check
Expand Down

0 comments on commit a0f8312

Please sign in to comment.