Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a81aa91
commit dbb2650
Showing
18 changed files
with
109 additions
and
139 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# skip test on GitHub | ||
if (!"GITHUB_ACTION" %in% names(Sys.getenv())) { | ||
# skip test on GitHub and CRAN | ||
skip_on_ci() | ||
skip_on_cran() | ||
|
||
library(sf) | ||
|
||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
polygon = read_sf(polygon_path) | ||
req_df = DEM_request(polygon) | ||
library(sf) | ||
|
||
# if output is "connection error", check class and return NULL | ||
if (class(req_df) == "character") { | ||
return(NULL) | ||
} | ||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
polygon = read_sf(polygon_path) | ||
req_df = DEM_request(polygon) | ||
|
||
# if output is "connection error", check class and return NULL | ||
if (class(req_df) == "character") { | ||
return(NULL) | ||
} | ||
|
||
test_that("check if ouput is data frame", { | ||
expect_s3_class(req_df, "data.frame") | ||
}) | ||
|
||
test_that("check number of rows", { | ||
expect_true(nrow(req_df) > 0) | ||
}) | ||
test_that("check if ouput is data frame", { | ||
expect_s3_class(req_df, "data.frame") | ||
}) | ||
|
||
test_that("check number of columns", { | ||
expect_true(ncol(req_df) == 13) | ||
}) | ||
test_that("check number of rows", { | ||
expect_true(nrow(req_df) > 0) | ||
}) | ||
|
||
} | ||
test_that("check number of columns", { | ||
expect_true(ncol(req_df) == 13) | ||
}) |
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
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 |
---|---|---|
@@ -1,34 +1,25 @@ | ||
# skip test on GitHub and CRAN | ||
cond = "GITHUB_ACTION" %in% names(Sys.getenv()) || | ||
"CRAN" %in% names(Sys.getenv()) | ||
skip_on_ci() | ||
skip_on_cran() | ||
|
||
if (!cond) { | ||
|
||
tmp = tempfile() | ||
status = geodb_download("opolskie", outdir = tmp, unzip = FALSE) # 5.8 MB | ||
tmp = tempfile() | ||
status = geodb_download("opolskie", outdir = tmp, unzip = FALSE) # 5.8 MB | ||
|
||
# status should be NULL (successfully downloaded), otherwise return NULL | ||
if (!is.null(status)) { | ||
return(NULL) | ||
} | ||
|
||
file_path = list.files(tmp, full.names = TRUE) | ||
file_size = file.info(file_path)$size / 2^20 | ||
file_ext = substr(file_path, nchar(file_path) - 2, nchar(file_path)) | ||
|
||
|
||
test_that("check file size", { | ||
expect_true(file_size > 5.8) | ||
}) | ||
# status should be NULL (successfully downloaded), otherwise return NULL | ||
if (!is.null(status)) { | ||
return(NULL) | ||
} | ||
|
||
test_that("check file ext", { | ||
expect_true(file_ext == "zip") | ||
}) | ||
file_path = list.files(tmp, full.names = TRUE) | ||
file_ext = substr(file_path, nchar(file_path) - 2, nchar(file_path)) | ||
|
||
test_that("check file ext", { | ||
expect_true(file_ext == "zip") | ||
}) | ||
|
||
# test stops | ||
test_that("check stops", { | ||
expect_error(geodb_download(voivodeships = NULL), "enter names or TERC") | ||
}) | ||
|
||
} | ||
# test stops | ||
test_that("check stops", { | ||
expect_error(geodb_download(voivodeships = NULL), "enter names or TERC") | ||
}) |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
skip_on_cran() | ||
|
||
|
||
library(sf) | ||
|
||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
|
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# skip test on GitHub | ||
if (!"GITHUB_ACTION" %in% names(Sys.getenv())) { | ||
# skip test on GitHub and CRAN | ||
skip_on_ci() | ||
skip_on_cran() | ||
|
||
library(sf) | ||
|
||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
polygon = read_sf(polygon_path) | ||
req_df = ortho_request(polygon) | ||
library(sf) | ||
|
||
# if output is "connection error", check class and return NULL | ||
if (class(req_df) == "character") { | ||
return(NULL) | ||
} | ||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
polygon = read_sf(polygon_path) | ||
req_df = ortho_request(polygon) | ||
|
||
# if output is "connection error", check class and return NULL | ||
if (class(req_df) == "character") { | ||
return(NULL) | ||
} | ||
|
||
test_that("check if ouput is data frame", { | ||
expect_s3_class(req_df, "data.frame") | ||
}) | ||
|
||
test_that("check number of rows", { | ||
expect_true(nrow(req_df) > 0) | ||
}) | ||
test_that("check if ouput is data frame", { | ||
expect_s3_class(req_df, "data.frame") | ||
}) | ||
|
||
test_that("check number of columns", { | ||
expect_true(ncol(req_df) == 12) | ||
}) | ||
test_that("check number of rows", { | ||
expect_true(nrow(req_df) > 0) | ||
}) | ||
|
||
} | ||
test_that("check number of columns", { | ||
expect_true(ncol(req_df) == 12) | ||
}) |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
skip_on_cran() | ||
|
||
|
||
library(sf) | ||
|
||
polygon_path = system.file("datasets/search_area.gpkg", package = "rgugik") | ||
|
Oops, something went wrong.