Skip to content

Commit

Permalink
better paths for testing?
Browse files Browse the repository at this point in the history
  • Loading branch information
wcornwell committed Nov 15, 2024
1 parent f17a044 commit abcfc85
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/testthat/test-test_spectral.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ test_that("calculate_cv works", {
})

test_that("extract_pixel_values works", {
aoi_files <- list.files('../../inst/extdata/fishnet',
pattern = '_fishnet.shp$', full.names = TRUE)
raster_files <- list.files('../../inst/extdata/multiband_image',
pattern = '.tif$', full.names = TRUE)
pixelvalues <- extract_pixel_values(raster_files, aoi_files,
c('blue', 'green', 'red', 'red_edge', 'nir'))
expect_true(dim(pixelvalues)[1]>20000)
expect_true(mean(pixelvalues[,3])>0.05 & mean(pixelvalues[,3])<0.06)
aoi_files <- list.files(
system.file("extdata/fishnet", package = "saltbush"),
pattern = '_fishnet.shp$', full.names = TRUE
)
raster_files <- list.files(
system.file("extdata/multiband_image", package = "saltbush"),
pattern = '.tif$', full.names = TRUE
)
pixelvalues <- extract_pixel_values(
raster_files, aoi_files, c('blue', 'green', 'red', 'red_edge', 'nir')
)
expect_true(dim(pixelvalues)[1] > 20000)
expect_true(mean(pixelvalues[,3]) > 0.05 & mean(pixelvalues[,3]) < 0.06)
})

0 comments on commit abcfc85

Please sign in to comment.