-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing spatial functions in global.R (#90)
* Code to generate link in processing #87 * Renames Establishment means earlier in workflow to remove processing in server.R * Moved renaming of voucher location to repository to earlier workflow and out of server. Removed creation of URL from server and directly using link field. * Suppressed warnings from APCalign #87 * Removed URL creaton in downloadhandler * Small test for load_places * Specifying dependencies and simple test for circle * Updated snapshot * Tests for spatial functions in infinitylists * Test and code to fail gracefully #91
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
test_that("Loading a place successfully", { | ||
places <- list.files(system.file(package = "infinitylists", "extdata", "places")) | ||
paths <- file.path(system.file(package = "infinitylists", "extdata", "places", places)) | ||
|
||
kmls <- purrr::map(paths, | ||
~load_place(.x) | ||
) | ||
|
||
expect_visible(purrr::map(paths, | ||
~load_place(.x)) | ||
) | ||
|
||
expect_type(kmls[[1]], "list") | ||
|
||
expect_visible(places) | ||
expect_type(places, "character") | ||
}) | ||
|
||
|
||
test_that("Circle or buffer is added", { | ||
# malabar | ||
radii <- seq(10,100, by = 10) | ||
|
||
expect_visible(purrr::map(radii, | ||
~create_circle_polygon(lat = 33.9679, long = 151.2511, .x) | ||
)) | ||
|
||
with_circles <- purrr::map(radii, | ||
~create_circle_polygon(lat = 33.9679, long = 151.2511, .x) | ||
) | ||
expect_type(with_circles[[1]], "list") | ||
|
||
expect_error(add_buffer(with_circles, 5)) | ||
}) | ||
|
||
test_that("Intersections are working", { | ||
occ <- dplyr::tibble(lat = 33.9679, long = 151.2511) | ||
occ_sf <- sf::st_as_sf(occ, coords = c("long", "lat"), crs = 4326) | ||
|
||
expect_true(points_in_target(occ_sf, create_circle_polygon(lat = 33.9679, long = 151.2511, 10))) | ||
|
||
expect_true(points_in_buffer(occ_sf, create_circle_polygon(lat = 33.9679, long = 151.2511, 10), buffer_size = 10)) | ||
}) | ||
|
||
|
||
|
||
|
||
|
||
|