-
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.
- Loading branch information
Showing
2 changed files
with
20 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
# | ||
# This test file has been generated by kwb.test::create_test_files() | ||
# launched by user hsonne on 2022-09-16 16:40:56. | ||
# Your are strongly encouraged to modify the dummy functions | ||
# so that real cases are tested. You should then delete this comment. | ||
# | ||
#library(testthat) | ||
|
||
test_that("get_shape_of_german_region() works", { | ||
|
||
f <- kwb.dwd:::get_shape_of_german_region | ||
|
||
expect_error( | ||
f() | ||
# argument "name" is missing, with no default | ||
) | ||
expect_error(f()) | ||
|
||
expect_error(f("no-such-region"), "No such element") | ||
|
||
result <- f("berlin") | ||
|
||
expect_s3_class(result, "sf") | ||
}) |
22 changes: 13 additions & 9 deletions
22
tests/testthat/test-function-read_asc_gz_file_into_matrix.R
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,17 +1,21 @@ | ||
# | ||
# This test file has been generated by kwb.test::create_test_files() | ||
# launched by user hsonne on 2022-09-16 16:43:25. | ||
# Your are strongly encouraged to modify the dummy functions | ||
# so that real cases are tested. You should then delete this comment. | ||
# | ||
#library(testthat) | ||
|
||
test_that("read_asc_gz_file_into_matrix() works", { | ||
|
||
f <- kwb.dwd:::read_asc_gz_file_into_matrix | ||
|
||
expect_error( | ||
f() | ||
# argument "url" is missing, with no default | ||
expect_error(f()) | ||
|
||
url <- kwb.dwd:::list_grids_germany( | ||
resolution = "monthly", | ||
extension = ".asc.gz", | ||
variable = "evapo_p", | ||
from = "202001", | ||
to = "202001" | ||
) | ||
|
||
result <- f(file = url) | ||
|
||
expect_true(is.matrix(result)) | ||
expect_true("NODATA_value" %in% names(attributes(result))) | ||
}) |